load packages for Linear Mixed Model analysis

3 Result (The following headings respond to the manuscript sections)

3.1 Manipulation checks and results

3.1.1 KSS ratings

# read data
KSSdata <- read_excel("/Users/betty/Desktop/KSS(processed).xlsx", sheet=1)


# as factors
KSSdata$condition <- as.factor(KSSdata$condition)
KSSdata$`agegroup2` <- as.factor(KSSdata$`agegroup2`)
KSSdata$beforeafter <- as.factor(KSSdata$beforeafter)

# groupby
KSSdata %>%
  group_by(condition, `agegroup2`, beforeafter)
## # A tibble: 290 × 7
## # Groups:   condition, agegroup2, beforeafter [20]
##      sub   age agegroup2 condition order beforeafter score
##    <dbl> <dbl> <fct>     <fct>     <dbl> <fct>       <dbl>
##  1     1    42 M         control       1 before        7  
##  2     2    36 M         control       1 before        7  
##  3     3    24 Y         control       1 before        7  
##  4     4    30 Y         control       5 before        7  
##  5     5    35 Y         control       3 before        7  
##  6     6    43 M         control       3 before        7  
##  7     7    26 Y         control       4 before        7  
##  8     8    24 Y         control       5 before        7.5
##  9     9    25 Y         control       4 before        6  
## 10    10    36 M         control       5 before        9  
## # ℹ 280 more rows
# younger drivers
filter.young<- filter(KSSdata, agegroup2 =="Y") 
## main effect of countermeasures for before countermeasure
filter1<- filter(filter.young, beforeafter =="before") 
res.fried.KSS.young.before <- filter1 %>% friedman_test(score ~ condition |sub)
res.fried.KSS.young.before
## # A tibble: 1 × 6
##   .y.       n statistic    df     p method       
## * <chr> <int>     <dbl> <dbl> <dbl> <chr>        
## 1 score    15      3.59     4 0.464 Friedman test
## post hoc analysis of countermeasures for before countermeasure
pwc.KSS.inter.young.before <- filter1 %>% wilcox_test(score ~ condition, paired = TRUE, p.adjust.method = "bonferroni")
pwc.KSS.inter.young.before
## # A tibble: 10 × 9
##    .y.   group1        group2        n1    n2 statistic     p p.adj p.adj.signif
##  * <chr> <chr>         <chr>      <int> <int>     <dbl> <dbl> <dbl> <chr>       
##  1 score answer        control       15    15      27   0.227     1 ns          
##  2 score answer        meaningfu…    15    15      21   0.525     1 ns          
##  3 score answer        meaningle…    15    15      33   0.589     1 ns          
##  4 score answer        repeat        15    15      37   0.904     1 ns          
##  5 score control       meaningfu…    15    15       9   0.112     1 ns          
##  6 score control       meaningle…    15    15      14.5 0.66      1 ns          
##  7 score control       repeat        15    15      14   0.178     1 ns          
##  8 score meaningfully  meaningle…    15    15      31.5 0.275     1 ns          
##  9 score meaningfully  repeat        15    15      16.5 0.731     1 ns          
## 10 score meaninglessly repeat        15    15      15   0.383     1 ns
## main effect of countermeasures for after countermeasure
filter1<- filter(filter.young, beforeafter =="after") 
res.fried.KSS.young.after <- filter1 %>% friedman_test(score ~ condition |sub)
res.fried.KSS.young.after
## # A tibble: 1 × 6
##   .y.       n statistic    df          p method       
## * <chr> <int>     <dbl> <dbl>      <dbl> <chr>        
## 1 score    15      29.8     4 0.00000534 Friedman test
## post hoc analysis of countermeasures for after countermeasure
pwc.KSS.inter.young.after <- filter1 %>% wilcox_test(score ~ condition, paired = TRUE, p.adjust.method = "bonferroni")
pwc.KSS.inter.young.after
## # A tibble: 10 × 9
##    .y.   group1        group2      n1    n2 statistic       p p.adj p.adj.signif
##  * <chr> <chr>         <chr>    <int> <int>     <dbl>   <dbl> <dbl> <chr>       
##  1 score answer        control     15    15       0   6.98e-4 0.007 **          
##  2 score answer        meaning…    15    15       7   3   e-3 0.027 *           
##  3 score answer        meaning…    15    15       7   3   e-3 0.028 *           
##  4 score answer        repeat      15    15      12.5 4   e-2 0.397 ns          
##  5 score control       meaning…    15    15      77.5 2.5 e-2 0.249 ns          
##  6 score control       meaning…    15    15      60.5 8.8 e-2 0.884 ns          
##  7 score control       repeat      15    15     115   2   e-3 0.017 *           
##  8 score meaningfully  meaning…    15    15      13.5 3.09e-1 1     ns          
##  9 score meaningfully  repeat      15    15      69   1.7 e-2 0.167 ns          
## 10 score meaninglessly repeat      15    15      80   1.7 e-2 0.167 ns
# middle-aged drivers
filter.elder<- filter(KSSdata, agegroup2 =="M") 
## main effect of countermeasures for before countermeasure
filter1<- filter(filter.elder, beforeafter =="before") 
res.fried.KSS.middle.before <- filter1 %>% friedman_test(score ~ condition |sub)
res.fried.KSS.middle.before
## # A tibble: 1 × 6
##   .y.       n statistic    df      p method       
## * <chr> <int>     <dbl> <dbl>  <dbl> <chr>        
## 1 score    14      10.5     4 0.0330 Friedman test
## post hoc analysis of countermeasures for before countermeasure
pwc.KSS.inter.middle.before <- filter1 %>% wilcox_test(score ~ condition, paired = TRUE, p.adjust.method = "bonferroni")
pwc.KSS.inter.middle.before
## # A tibble: 10 × 9
##    .y.   group1        group2        n1    n2 statistic     p p.adj p.adj.signif
##  * <chr> <chr>         <chr>      <int> <int>     <dbl> <dbl> <dbl> <chr>       
##  1 score answer        control       14    14      60   0.015 0.153 ns          
##  2 score answer        meaningfu…    14    14      34   0.17  1     ns          
##  3 score answer        meaningle…    14    14      24   0.105 1     ns          
##  4 score answer        repeat        14    14      14   1     1     ns          
##  5 score control       meaningfu…    14    14       5.5 0.079 0.788 ns          
##  6 score control       meaningle…    14    14      14   0.337 1     ns          
##  7 score control       repeat        14    14       9   0.033 0.333 ns          
##  8 score meaningfully  meaningle…    14    14      28.5 0.506 1     ns          
##  9 score meaningfully  repeat        14    14       9   0.213 1     ns          
## 10 score meaninglessly repeat        14    14       7   0.072 0.725 ns
## main effect of countermeasures for after countermeasure
filter1<- filter(filter.elder, beforeafter =="after") 
res.fried.KSS.middle.after <- filter1 %>% friedman_test(score ~ condition |sub)
res.fried.KSS.middle.after
## # A tibble: 1 × 6
##   .y.       n statistic    df        p method       
## * <chr> <int>     <dbl> <dbl>    <dbl> <chr>        
## 1 score    14      21.8     4 0.000222 Friedman test
## post hoc analysis of countermeasures for after countermeasure
pwc.KSS.inter.middle.after <- filter1 %>% wilcox_test(score ~ condition, paired = TRUE, p.adjust.method = "bonferroni")
pwc.KSS.inter.middle.after
## # A tibble: 10 × 9
##    .y.   group1        group2        n1    n2 statistic     p p.adj p.adj.signif
##  * <chr> <chr>         <chr>      <int> <int>     <dbl> <dbl> <dbl> <chr>       
##  1 score answer        control       14    14       0   0.004 0.037 *           
##  2 score answer        meaningfu…    14    14      12   0.123 1     ns          
##  3 score answer        meaningle…    14    14       2   0.004 0.039 *           
##  4 score answer        repeat        14    14      16.5 0.074 0.742 ns          
##  5 score control       meaningfu…    14    14      53.5 0.009 0.088 ns          
##  6 score control       meaningle…    14    14      37.5 0.321 1     ns          
##  7 score control       repeat        14    14      61   0.014 0.138 ns          
##  8 score meaningfully  meaningle…    14    14      14.5 0.032 0.317 ns          
##  9 score meaningfully  repeat        14    14      20   0.809 1     ns          
## 10 score meaninglessly repeat        14    14      48.5 0.035 0.35  ns

3.1.2 PVT accuracy

# read data
databutton <- read_excel("/Users/betty/Desktop/buttonprocessed.xlsx", sheet=1)
databutton  <- select(databutton,"sub","agegroup2","week","condition","order","beforeafter","score2")

# as factors
databutton$condition <- as.factor(databutton$condition)
databutton$beforeafter <- as.factor(databutton$beforeafter)
databutton$agegroup2 <- as.factor(databutton$agegroup2)

# Hypothesis testing
## QQ plot for residual
lmmodel <- lm(score2 ~ condition, databutton)
summary(lmmodel)
## 
## Call:
## lm(formula = score2 ~ condition, data = databutton)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.50862 -0.15352 -0.00517  0.14436  0.53703 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             0.56200    0.02877  19.536   <2e-16 ***
## conditioncontrol       -0.10848    0.04068  -2.666   0.0081 ** 
## conditionmeaningfully  -0.05683    0.04068  -1.397   0.1636    
## conditionmeaninglessly -0.09903    0.04068  -2.434   0.0155 *  
## conditionrepeat        -0.05338    0.04068  -1.312   0.1906    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2191 on 285 degrees of freedom
## Multiple R-squared:  0.03068,    Adjusted R-squared:  0.01708 
## F-statistic: 2.255 on 4 and 285 DF,  p-value: 0.06334
res_lmmodel <- residuals(lmmodel)
qqnorm(res_lmmodel) 

## KS test for residual
ks.test(res_lmmodel, "pnorm", mean(res_lmmodel), sd(res_lmmodel))
## Warning in ks.test.default(res_lmmodel, "pnorm", mean(res_lmmodel),
## sd(res_lmmodel)): ties should not be present for the one-sample
## Kolmogorov-Smirnov test
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.068894, p-value = 0.1275
## alternative hypothesis: two-sided
## Levene’s test for residual
library(car)
## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
leveneTest(res_lmmodel, databutton$condition)
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   4  1.2621 0.2851
##       285
# younger drivers
filter.Y <- filter(databutton, agegroup2 =="Y") 
## main effect of countermeasures for before countermeasure
filter1.before <- filter(filter.Y, beforeafter =="beforeintervene") 
Model <- lmer(data = filter1.before, score2 ~condition +(1|sub) )
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: score2 ~ condition + (1 | sub)
##    Data: filter1.before
## 
## REML criterion at convergence: -12.9
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.40298 -0.50155  0.03663  0.61094  2.51597 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.002588 0.05087 
##  Residual             0.037832 0.19450 
## Number of obs: 75, groups:  sub, 15
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)             0.482400   0.051910 68.870483   9.293 8.92e-14 ***
## conditioncontrol        0.004267   0.071023 56.000000   0.060    0.952    
## conditionmeaningfully  -0.069067   0.071023 56.000000  -0.972    0.335    
## conditionmeaninglessly -0.093267   0.071023 56.000000  -1.313    0.194    
## conditionrepeat        -0.075733   0.071023 56.000000  -1.066    0.291    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.684                             
## cndtnmnngfl -0.684  0.500                      
## cndtnmnngls -0.684  0.500  0.500               
## conditinrpt -0.684  0.500  0.500      0.500
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq  Mean Sq NumDF DenDF F value Pr(>F)
## condition 0.12435 0.031088     4    56  0.8217 0.5168
## post hoc analysis of countermeasures for before countermeasure
pwc.PVT.inter.young.before <- filter1.before %>% pairwise_t_test(score2 ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc.PVT.inter.young.before 
## # A tibble: 10 × 10
##    .y.    group1     group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>  <chr>      <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 score2 answer     contr…    15    15   -0.0652    14 0.949 1     ns          
##  2 score2 answer     meani…    15    15    1.11      14 0.285 1     ns          
##  3 score2 answer     meani…    15    15    1.25      14 0.23  1     ns          
##  4 score2 answer     repeat    15    15    1.86      14 0.084 0.835 ns          
##  5 score2 control    meani…    15    15    1.05      14 0.313 1     ns          
##  6 score2 control    meani…    15    15    1.15      14 0.268 1     ns          
##  7 score2 control    repeat    15    15    0.993     14 0.338 1     ns          
##  8 score2 meaningfu… meani…    15    15    0.307     14 0.763 1     ns          
##  9 score2 meaningfu… repeat    15    15    0.107     14 0.916 1     ns          
## 10 score2 meaningle… repeat    15    15   -0.217     14 0.831 1     ns
## main effect of countermeasures for after countermeasure
filter1.after<- filter(filter.Y, beforeafter =="afterintervene") 
Model.PVT.2 <- lmer(data = filter1.after, score2~condition +(1|sub) )
summary(Model.PVT.2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: score2 ~ condition + (1 | sub)
##    Data: filter1.after
## 
## REML criterion at convergence: -1.3
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.33457 -0.57873  0.04228  0.55152  1.92542 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.005999 0.07745 
##  Residual             0.042569 0.20632 
## Number of obs: 75, groups:  sub, 15
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)             0.57573    0.05690 65.97438  10.118 4.72e-15 ***
## conditioncontrol       -0.11573    0.07534 56.00000  -1.536   0.1301    
## conditionmeaningfully  -0.12907    0.07534 56.00000  -1.713   0.0922 .  
## conditionmeaninglessly -0.13647    0.07534 56.00000  -1.811   0.0754 .  
## conditionrepeat        -0.07573    0.07534 56.00000  -1.005   0.3191    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.662                             
## cndtnmnngfl -0.662  0.500                      
## cndtnmnngls -0.662  0.500  0.500               
## conditinrpt -0.662  0.500  0.500      0.500
anova(Model.PVT.2)
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq  Mean Sq NumDF DenDF F value Pr(>F)
## condition 0.18962 0.047405     4    56  1.1136 0.3593
## post hoc analysis of countermeasures for after countermeasure
pwc.PVT.inter.young.after <- filter1.after %>% pairwise_t_test(score2 ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc.PVT.inter.young.after 
## # A tibble: 10 × 10
##    .y.    group1     group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>  <chr>      <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 score2 answer     contr…    15    15     1.72     14 0.108     1 ns          
##  2 score2 answer     meani…    15    15     1.74     14 0.104     1 ns          
##  3 score2 answer     meani…    15    15     1.65     14 0.121     1 ns          
##  4 score2 answer     repeat    15    15     0.816    14 0.428     1 ns          
##  5 score2 control    meani…    15    15     0.225    14 0.825     1 ns          
##  6 score2 control    meani…    15    15     0.285    14 0.779     1 ns          
##  7 score2 control    repeat    15    15    -0.705    14 0.492     1 ns          
##  8 score2 meaningfu… meani…    15    15     0.119    14 0.907     1 ns          
##  9 score2 meaningfu… repeat    15    15    -0.679    14 0.508     1 ns          
## 10 score2 meaningle… repeat    15    15    -0.633    14 0.537     1 ns
# middle-aged group
filter.M <- filter(databutton, agegroup2 =="M") 
## main effect of countermeasures for before countermeasure
filter1.before <- filter(filter.M, beforeafter =="beforeintervene") 
Model <- lmer(data = filter1.before, score2 ~condition +(1|sub) )
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: score2 ~ condition + (1 | sub)
##    Data: filter1.before
## 
## REML criterion at convergence: -2.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0509 -0.6224 -0.1950  0.8359  2.3852 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.00000  0.0000  
##  Residual             0.04601  0.2145  
## Number of obs: 70, groups:  sub, 14
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)             0.54371    0.05733 65.00000   9.484 7.02e-14 ***
## conditioncontrol       -0.10379    0.08108 65.00000  -1.280    0.205    
## conditionmeaningfully  -0.02943    0.08108 65.00000  -0.363    0.718    
## conditionmeaninglessly -0.05536    0.08108 65.00000  -0.683    0.497    
## conditionrepeat         0.04200    0.08108 65.00000   0.518    0.606    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.707                             
## cndtnmnngfl -0.707  0.500                      
## cndtnmnngls -0.707  0.500  0.500               
## conditinrpt -0.707  0.500  0.500      0.500    
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq  Mean Sq NumDF DenDF F value Pr(>F)
## condition 0.17037 0.042593     4    65  0.9256 0.4546
## post hoc analysis of countermeasures for before countermeasure
pwc.PVT.inter.middle.before <- filter1.before %>% pairwise_t_test(score2 ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc.PVT.inter.middle.before
## # A tibble: 10 × 10
##    .y.    group1     group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>  <chr>      <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 score2 answer     contr…    14    14     0.998    13 0.336 1     ns          
##  2 score2 answer     meani…    14    14     0.341    13 0.738 1     ns          
##  3 score2 answer     meani…    14    14     0.638    13 0.534 1     ns          
##  4 score2 answer     repeat    14    14    -0.571    13 0.578 1     ns          
##  5 score2 control    meani…    14    14    -0.863    13 0.404 1     ns          
##  6 score2 control    meani…    14    14    -0.492    13 0.631 1     ns          
##  7 score2 control    repeat    14    14    -1.35     13 0.2   1     ns          
##  8 score2 meaningfu… meani…    14    14     0.295    13 0.773 1     ns          
##  9 score2 meaningfu… repeat    14    14    -0.836    13 0.418 1     ns          
## 10 score2 meaningle… repeat    14    14    -2.01     13 0.066 0.655 ns
## main effect of countermeasures for after countermeasure
filter1.after<- filter(filter.M, beforeafter =="afterintervene") 
Model <- lmer(data = filter1.after, score2~condition +(1|sub) )
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: score2 ~ condition + (1 | sub)
##    Data: filter1.after
## 
## REML criterion at convergence: 3.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.9334 -0.4811  0.1913  0.6657  2.1219 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.00000  0.000   
##  Residual             0.05019  0.224   
## Number of obs: 70, groups:  sub, 14
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)             0.650857   0.059872 65.000000  10.871  2.9e-16 ***
## conditioncontrol       -0.226214   0.084672 65.000000  -2.672  0.00953 ** 
## conditionmeaningfully   0.006286   0.084672 65.000000   0.074  0.94105    
## conditionmeaninglessly -0.108786   0.084672 65.000000  -1.285  0.20343    
## conditionrepeat        -0.100857   0.084672 65.000000  -1.191  0.23793    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.707                             
## cndtnmnngfl -0.707  0.500                      
## cndtnmnngls -0.707  0.500  0.500               
## conditinrpt -0.707  0.500  0.500      0.500    
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF DenDF F value  Pr(>F)  
## condition 0.50838 0.12709     4    65  2.5325 0.04861 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## post hoc analysis of countermeasures for after countermeasure
pwc.PVT.inter.middle.after <- filter1.after %>% pairwise_t_test(score2 ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc.PVT.inter.middle.after
## # A tibble: 10 × 10
##    .y.    group1     group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>  <chr>      <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 score2 answer     contr…    14    14    2.72      13 0.018 0.175 ns          
##  2 score2 answer     meani…    14    14   -0.0777    13 0.939 1     ns          
##  3 score2 answer     meani…    14    14    1.62      13 0.128 1     ns          
##  4 score2 answer     repeat    14    14    1.34      13 0.203 1     ns          
##  5 score2 control    meani…    14    14   -2.44      13 0.03  0.296 ns          
##  6 score2 control    meani…    14    14   -1.18      13 0.258 1     ns          
##  7 score2 control    repeat    14    14   -1.12      13 0.281 1     ns          
##  8 score2 meaningfu… meani…    14    14    1.25      13 0.233 1     ns          
##  9 score2 meaningfu… repeat    14    14    1.55      13 0.145 1     ns          
## 10 score2 meaningle… repeat    14    14   -0.101     13 0.921 1     ns

3.2 Driving performance

3.2.1 SDLP

## 
## Call:
## lm(formula = SDLP ~ condition * beforeafter, data = SDLPdata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.88576 -0.25101 -0.04114  0.18767  1.29628 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           1.01759    0.07000  14.537   <2e-16 ***
## conditioncontrol                     -0.12548    0.09900  -1.268   0.2060    
## conditionmeaningfully                -0.03852    0.09900  -0.389   0.6975    
## conditionmeaninglessly               -0.09040    0.09900  -0.913   0.3619    
## conditionrepeat                       0.13517    0.09900   1.365   0.1732    
## beforeafteron                        -0.18586    0.09900  -1.877   0.0615 .  
## conditioncontrol:beforeafteron        0.36069    0.14000   2.576   0.0105 *  
## conditionmeaningfully:beforeafteron   0.22524    0.14000   1.609   0.1088    
## conditionmeaninglessly:beforeafteron  0.34530    0.14000   2.466   0.0142 *  
## conditionrepeat:beforeafteron        -0.17052    0.14000  -1.218   0.2243    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.377 on 280 degrees of freedom
## Multiple R-squared:  0.07906,    Adjusted R-squared:  0.04946 
## F-statistic: 2.671 on 9 and 280 DF,  p-value: 0.005463

## Warning in ks.test.default(res_lmmodel, "pnorm", mean(res_lmmodel),
## sd(res_lmmodel)): ties should not be present for the one-sample
## Kolmogorov-Smirnov test
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.074915, p-value = 0.07715
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value  Pr(>F)  
## group   9  1.8339 0.06212 .
##       280                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call:
## lm(formula = log(SDLP) ~ condition * beforeafter, data = SDLPdata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.36356 -0.23705  0.01497  0.26650  1.00415 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)  
## (Intercept)                          -0.07155    0.07178  -0.997   0.3197  
## conditioncontrol                     -0.12347    0.10152  -1.216   0.2249  
## conditionmeaningfully                -0.04054    0.10152  -0.399   0.6899  
## conditionmeaninglessly               -0.04567    0.10152  -0.450   0.6532  
## conditionrepeat                       0.11460    0.10152   1.129   0.2599  
## beforeafteron                        -0.17742    0.10152  -1.748   0.0816 .
## conditioncontrol:beforeafteron        0.34692    0.14357   2.416   0.0163 *
## conditionmeaningfully:beforeafteron   0.25314    0.14357   1.763   0.0790 .
## conditionmeaninglessly:beforeafteron  0.33215    0.14357   2.314   0.0214 *
## conditionrepeat:beforeafteron        -0.13153    0.14357  -0.916   0.3604  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3866 on 280 degrees of freedom
## Multiple R-squared:  0.07021,    Adjusted R-squared:  0.04033 
## F-statistic: 2.349 on 9 and 280 DF,  p-value: 0.01436

## Warning in ks.test.default(res_lmmodel, "pnorm", mean(res_lmmodel),
## sd(res_lmmodel)): ties should not be present for the one-sample
## Kolmogorov-Smirnov test
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.054475, p-value = 0.3557
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   9  1.1252 0.3447
##       280
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDLP ~ condition * beforeafter * agegroup2 + (1 | sub)
##    Data: SDLPdata
## 
## REML criterion at convergence: 238.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0071 -0.5049 -0.0318  0.5780  2.9069 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.05821  0.2413  
##  Residual             0.09549  0.3090  
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                                   Estimate Std. Error
## (Intercept)                                      -0.075832   0.104776
## conditioncontrol                                 -0.099603   0.116795
## conditionmeaningfully                            -0.050611   0.116795
## conditionmeaninglessly                           -0.021721   0.116795
## conditionrepeat                                   0.120110   0.116795
## beforeafteron                                    -0.125023   0.116795
## agegroup2Y                                        0.008273   0.145685
## conditioncontrol:beforeafteron                    0.335424   0.165173
## conditionmeaningfully:beforeafteron               0.157296   0.165173
## conditionmeaninglessly:beforeafteron              0.215010   0.165173
## conditionrepeat:beforeafteron                    -0.164461   0.165173
## conditioncontrol:agegroup2Y                      -0.046144   0.162396
## conditionmeaningfully:agegroup2Y                  0.019464   0.162396
## conditionmeaninglessly:agegroup2Y                -0.046295   0.162396
## conditionrepeat:agegroup2Y                       -0.010645   0.162396
## beforeafteron:agegroup2Y                         -0.101294   0.162396
## conditioncontrol:beforeafteron:agegroup2Y         0.022221   0.229663
## conditionmeaningfully:beforeafteron:agegroup2Y    0.185299   0.229663
## conditionmeaninglessly:beforeafteron:agegroup2Y   0.226475   0.229663
## conditionrepeat:beforeafteron:agegroup2Y          0.063661   0.229663
##                                                         df t value Pr(>|t|)  
## (Intercept)                                     117.862084  -0.724   0.4706  
## conditioncontrol                                243.000000  -0.853   0.3946  
## conditionmeaningfully                           243.000000  -0.433   0.6652  
## conditionmeaninglessly                          243.000000  -0.186   0.8526  
## conditionrepeat                                 243.000000   1.028   0.3048  
## beforeafteron                                   243.000000  -1.070   0.2855  
## agegroup2Y                                      117.862084   0.057   0.9548  
## conditioncontrol:beforeafteron                  243.000000   2.031   0.0434 *
## conditionmeaningfully:beforeafteron             243.000000   0.952   0.3419  
## conditionmeaninglessly:beforeafteron            243.000000   1.302   0.1942  
## conditionrepeat:beforeafteron                   243.000000  -0.996   0.3204  
## conditioncontrol:agegroup2Y                     243.000000  -0.284   0.7765  
## conditionmeaningfully:agegroup2Y                243.000000   0.120   0.9047  
## conditionmeaninglessly:agegroup2Y               243.000000  -0.285   0.7758  
## conditionrepeat:agegroup2Y                      243.000000  -0.066   0.9478  
## beforeafteron:agegroup2Y                        243.000000  -0.624   0.5334  
## conditioncontrol:beforeafteron:agegroup2Y       243.000000   0.097   0.9230  
## conditionmeaningfully:beforeafteron:agegroup2Y  243.000000   0.807   0.4206  
## conditionmeaninglessly:beforeafteron:agegroup2Y 243.000000   0.986   0.3251  
## conditionrepeat:beforeafteron:agegroup2Y        243.000000   0.277   0.7819  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## Type III Analysis of Variance Table with Satterthwaite's method
##                                  Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)
## condition                       0.45834 0.11459     4   243  1.2000    0.3114
## beforeafter                     0.02155 0.02155     1   243  0.2257    0.6352
## agegroup2                       0.00089 0.00089     1    27  0.0093    0.9238
## condition:beforeafter           2.64184 0.66046     4   243  6.9168 2.742e-05
## condition:agegroup2             0.19216 0.04804     4   243  0.5031    0.7335
## beforeafter:agegroup2           0.00006 0.00006     1   243  0.0006    0.9806
## condition:beforeafter:agegroup2 0.14715 0.03679     4   243  0.3853    0.8191
##                                    
## condition                          
## beforeafter                        
## agegroup2                          
## condition:beforeafter           ***
## condition:agegroup2                
## beforeafter:agegroup2              
## condition:beforeafter:agegroup2    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDLP ~ condition + (1 | sub)
##    Data: filter1.before
## 
## REML criterion at convergence: 148.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5595 -0.4646 -0.0047  0.7476  1.9585 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.0634   0.2518  
##  Residual             0.1152   0.3394  
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)
## (Intercept)             -0.07155    0.07848  93.09034  -0.912    0.364
## conditioncontrol        -0.12347    0.08914 112.00000  -1.385    0.169
## conditionmeaningfully   -0.04054    0.08914 112.00000  -0.455    0.650
## conditionmeaninglessly  -0.04567    0.08914 112.00000  -0.512    0.609
## conditionrepeat          0.11460    0.08914 112.00000   1.286    0.201
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.568                             
## cndtnmnngfl -0.568  0.500                      
## cndtnmnngls -0.568  0.500  0.500               
## conditinrpt -0.568  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 0.87871 0.21968     4   112  1.9065 0.1143
## # A tibble: 10 × 10
##    .y.   group1      group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr> <chr>       <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 SDLP  answer      contr…    29    29    1.37      28 0.183 1     ns          
##  2 SDLP  answer      meani…    29    29    0.411     28 0.684 1     ns          
##  3 SDLP  answer      meani…    29    29    0.480     28 0.635 1     ns          
##  4 SDLP  answer      repeat    29    29   -1.53      28 0.137 1     ns          
##  5 SDLP  control     meani…    29    29   -0.842     28 0.407 1     ns          
##  6 SDLP  control     meani…    29    29   -1.12      28 0.273 1     ns          
##  7 SDLP  control     repeat    29    29   -2.85      28 0.008 0.082 ns          
##  8 SDLP  meaningful… meani…    29    29    0.0526    28 0.958 1     ns          
##  9 SDLP  meaningful… repeat    29    29   -1.74      28 0.092 0.924 ns          
## 10 SDLP  meaningles… repeat    29    29   -1.80      28 0.082 0.821 ns
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDLP ~ condition + (1 | sub)
##    Data: filter1.on
## 
## REML criterion at convergence: 92.8
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.47044 -0.51527 -0.03246  0.50840  3.12998 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.04311  0.2076  
##  Residual             0.07714  0.2777  
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)             -0.24897    0.06439  92.46116  -3.866 0.000205 ***
## conditioncontrol         0.22345    0.07294 112.00000   3.064 0.002741 ** 
## conditionmeaningfully    0.21260    0.07294 112.00000   2.915 0.004300 ** 
## conditionmeaninglessly   0.28648    0.07294 112.00000   3.928 0.000149 ***
## conditionrepeat         -0.01693    0.07294 112.00000  -0.232 0.816873    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.566                             
## cndtnmnngfl -0.566  0.500                      
## cndtnmnngls -0.566  0.500  0.500               
## conditinrpt -0.566  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## condition 2.2595 0.56486     4   112  7.3226 2.822e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 10 × 10
##    .y.   group1  group2    n1    n2 statistic    df       p   p.adj p.adj.signif
##  * <chr> <chr>   <chr>  <int> <int>     <dbl> <dbl>   <dbl>   <dbl> <chr>       
##  1 SDLP  answer  contr…    29    29    -2.32     28 2.8 e-2 2.77e-1 ns          
##  2 SDLP  answer  meani…    29    29    -3.00     28 6   e-3 5.6 e-2 ns          
##  3 SDLP  answer  meani…    29    29    -4.14     28 2.86e-4 3   e-3 **          
##  4 SDLP  answer  repeat    29    29     0.282    28 7.8 e-1 1   e+0 ns          
##  5 SDLP  control meani…    29    29     0.138    28 8.91e-1 1   e+0 ns          
##  6 SDLP  control meani…    29    29    -0.739    28 4.66e-1 1   e+0 ns          
##  7 SDLP  control repeat    29    29     3.32     28 3   e-3 2.5 e-2 *           
##  8 SDLP  meanin… meani…    29    29    -1.20     28 2.4 e-1 1   e+0 ns          
##  9 SDLP  meanin… repeat    29    29     3.78     28 7.54e-4 8   e-3 **          
## 10 SDLP  meanin… repeat    29    29     4.57     28 8.91e-5 8.91e-4 ***

3.2.2 SDVHA

## 
## Call:
## lm(formula = SDVH ~ condition * beforeafter, data = SDVHdata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.67721 -0.23507 -0.06415  0.12161  2.25838 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           0.75321    0.07107  10.598   <2e-16 ***
## conditioncontrol                     -0.11286    0.10051  -1.123   0.2624    
## conditionmeaningfully                -0.05100    0.10051  -0.507   0.6123    
## conditionmeaninglessly               -0.10562    0.10051  -1.051   0.2942    
## conditionrepeat                       0.10641    0.10051   1.059   0.2906    
## beforeafteron                        -0.19048    0.10051  -1.895   0.0591 .  
## conditioncontrol:beforeafteron        0.30479    0.14214   2.144   0.0329 *  
## conditionmeaningfully:beforeafteron   0.16610    0.14214   1.169   0.2436    
## conditionmeaninglessly:beforeafteron  0.37070    0.14214   2.608   0.0096 ** 
## conditionrepeat:beforeafteron        -0.14762    0.14214  -1.039   0.2999    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3827 on 280 degrees of freedom
## Multiple R-squared:  0.06902,    Adjusted R-squared:  0.0391 
## F-statistic: 2.307 on 9 and 280 DF,  p-value: 0.0163

## Warning in ks.test.default(res_lmmodel, "pnorm", mean(res_lmmodel),
## sd(res_lmmodel)): ties should not be present for the one-sample
## Kolmogorov-Smirnov test
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.1398, p-value = 2.387e-05
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   9  0.6792 0.7276
##       280
## 
## Call:
## lm(formula = log(SDVH) ~ condition * beforeafter, data = SDVHdata)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.1756 -0.3213  0.0310  0.2939  1.4348 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                          -0.40733    0.09527  -4.275 2.62e-05 ***
## conditioncontrol                     -0.14713    0.13474  -1.092   0.2758    
## conditionmeaningfully                -0.10595    0.13474  -0.786   0.4323    
## conditionmeaninglessly               -0.11304    0.13474  -0.839   0.4022    
## conditionrepeat                       0.10968    0.13474   0.814   0.4163    
## beforeafteron                        -0.27484    0.13474  -2.040   0.0423 *  
## conditioncontrol:beforeafteron        0.42540    0.19055   2.233   0.0264 *  
## conditionmeaningfully:beforeafteron   0.28109    0.19055   1.475   0.1413    
## conditionmeaninglessly:beforeafteron  0.48545    0.19055   2.548   0.0114 *  
## conditionrepeat:beforeafteron        -0.19366    0.19055  -1.016   0.3104    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5131 on 280 degrees of freedom
## Multiple R-squared:  0.07378,    Adjusted R-squared:  0.044 
## F-statistic: 2.478 on 9 and 280 DF,  p-value: 0.009795

## Warning in ks.test.default(res_lmmodel, "pnorm", mean(res_lmmodel),
## sd(res_lmmodel)): ties should not be present for the one-sample
## Kolmogorov-Smirnov test
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.04506, p-value = 0.5981
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   9   0.208 0.9931
##       280
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDVH ~ condition * beforeafter * agegroup2 + (1 | sub)
##    Data: SDVHdata
## 
## REML criterion at convergence: 363.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -7.5611 -0.4774  0.0161  0.5390  2.0382 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.1181   0.3436  
##  Residual             0.1482   0.3850  
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                                   Estimate Std. Error
## (Intercept)                                      -0.503660   0.137914
## conditioncontrol                                  0.004855   0.145507
## conditionmeaningfully                            -0.174970   0.145507
## conditionmeaninglessly                           -0.055690   0.145507
## conditionrepeat                                   0.112300   0.145507
## beforeafteron                                    -0.148515   0.145507
## agegroup2Y                                        0.186229   0.191762
## conditioncontrol:beforeafteron                    0.269060   0.205778
## conditionmeaningfully:beforeafteron               0.217282   0.205778
## conditionmeaninglessly:beforeafteron              0.332222   0.205778
## conditionrepeat:beforeafteron                    -0.245187   0.205778
## conditioncontrol:agegroup2Y                      -0.293846   0.202319
## conditionmeaningfully:agegroup2Y                  0.133443   0.202319
## conditionmeaninglessly:agegroup2Y                -0.110883   0.202319
## conditionrepeat:agegroup2Y                       -0.005061   0.202319
## beforeafteron:agegroup2Y                         -0.244223   0.202319
## conditioncontrol:beforeafteron:agegroup2Y         0.302254   0.286122
## conditionmeaningfully:beforeafteron:agegroup2Y    0.123362   0.286122
## conditionmeaninglessly:beforeafteron:agegroup2Y   0.296247   0.286122
## conditionrepeat:beforeafteron:agegroup2Y          0.099622   0.286122
##                                                         df t value Pr(>|t|)    
## (Intercept)                                      97.483775  -3.652 0.000421 ***
## conditioncontrol                                243.000000   0.033 0.973412    
## conditionmeaningfully                           243.000000  -1.202 0.230345    
## conditionmeaninglessly                          243.000000  -0.383 0.702251    
## conditionrepeat                                 243.000000   0.772 0.440993    
## beforeafteron                                   243.000000  -1.021 0.308423    
## agegroup2Y                                       97.483775   0.971 0.333879    
## conditioncontrol:beforeafteron                  243.000000   1.308 0.192269    
## conditionmeaningfully:beforeafteron             243.000000   1.056 0.292060    
## conditionmeaninglessly:beforeafteron            243.000000   1.614 0.107723    
## conditionrepeat:beforeafteron                   243.000000  -1.192 0.234615    
## conditioncontrol:agegroup2Y                     243.000000  -1.452 0.147683    
## conditionmeaningfully:agegroup2Y                243.000000   0.660 0.510155    
## conditionmeaninglessly:agegroup2Y               243.000000  -0.548 0.584153    
## conditionrepeat:agegroup2Y                      243.000000  -0.025 0.980064    
## beforeafteron:agegroup2Y                        243.000000  -1.207 0.228559    
## conditioncontrol:beforeafteron:agegroup2Y       243.000000   1.056 0.291844    
## conditionmeaningfully:beforeafteron:agegroup2Y  243.000000   0.431 0.666739    
## conditionmeaninglessly:beforeafteron:agegroup2Y 243.000000   1.035 0.301518    
## conditionrepeat:beforeafteron:agegroup2Y        243.000000   0.348 0.728006    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## Type III Analysis of Variance Table with Satterthwaite's method
##                                 Sum Sq Mean Sq NumDF DenDF F value   Pr(>F)    
## condition                       0.6282 0.15705     4   243  1.0597   0.3771    
## beforeafter                     0.3944 0.39443     1   243  2.6614   0.1041    
## agegroup2                       0.0669 0.06687     1    27  0.4512   0.5075    
## condition:beforeafter           4.7733 1.19332     4   243  8.0518 4.12e-06 ***
## condition:agegroup2             0.8432 0.21079     4   243  1.4223   0.2271    
## beforeafter:agegroup2           0.1156 0.11565     1   243  0.7803   0.3779    
## condition:beforeafter:agegroup2 0.2509 0.06272     4   243  0.4232   0.7918    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDVH ~ condition + (1 | sub)
##    Data: filter1.before
## 
## REML criterion at convergence: 222.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.3529 -0.4123  0.0272  0.5219  2.0906 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.0968   0.3111  
##  Residual             0.1993   0.4464  
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)             -0.4073     0.1010  98.0678  -4.031  0.00011 ***
## conditioncontrol        -0.1471     0.1172 112.0000  -1.255  0.21206    
## conditionmeaningfully   -0.1059     0.1172 112.0000  -0.904  0.36807    
## conditionmeaninglessly  -0.1130     0.1172 112.0000  -0.964  0.33698    
## conditionrepeat          0.1097     0.1172 112.0000   0.936  0.35149    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.580                             
## cndtnmnngfl -0.580  0.500                      
## cndtnmnngls -0.580  0.500  0.500               
## conditinrpt -0.580  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 1.2914 0.32284     4   112  1.6201 0.1741
## # A tibble: 10 × 10
##    .y.   group1      group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr> <chr>       <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 SDVH  answer      contr…    29    29    1.39      28 0.175 1     ns          
##  2 SDVH  answer      meani…    29    29    0.801     28 0.43  1     ns          
##  3 SDVH  answer      meani…    29    29    1.06      28 0.298 1     ns          
##  4 SDVH  answer      repeat    29    29   -1.27      28 0.215 1     ns          
##  5 SDVH  control     meani…    29    29   -0.287     28 0.776 1     ns          
##  6 SDVH  control     meani…    29    29   -0.401     28 0.692 1     ns          
##  7 SDVH  control     repeat    29    29   -3.10      28 0.004 0.044 *           
##  8 SDVH  meaningful… meani…    29    29    0.0459    28 0.964 1     ns          
##  9 SDVH  meaningful… repeat    29    29   -1.47      28 0.153 1     ns          
## 10 SDVH  meaningles… repeat    29    29   -2.25      28 0.032 0.322 ns
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDVH ~ condition + (1 | sub)
##    Data: filter1.on
## 
## REML criterion at convergence: 145.4
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.34750 -0.53643 -0.00654  0.66065  1.94659 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.13334  0.3652  
##  Residual             0.09705  0.3115  
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)             -0.68217    0.08913  59.83400  -7.653 1.95e-10 ***
## conditioncontrol         0.27826    0.08181 112.00000   3.401 0.000931 ***
## conditionmeaningfully    0.17514    0.08181 112.00000   2.141 0.034462 *  
## conditionmeaninglessly   0.37241    0.08181 112.00000   4.552 1.36e-05 ***
## conditionrepeat         -0.08398    0.08181 112.00000  -1.026 0.306897    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.459                             
## cndtnmnngfl -0.459  0.500                      
## cndtnmnngls -0.459  0.500  0.500               
## conditinrpt -0.459  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## condition 4.1696  1.0424     4   112   10.74 2.098e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 10 × 10
##    .y.   group1  group2    n1    n2 statistic    df       p   p.adj p.adj.signif
##  * <chr> <chr>   <chr>  <int> <int>     <dbl> <dbl>   <dbl>   <dbl> <chr>       
##  1 SDVH  answer  contr…    29    29     -3.19    28 3   e-3 3.5 e-2 *           
##  2 SDVH  answer  meani…    29    29     -2.35    28 2.6 e-2 2.63e-1 ns          
##  3 SDVH  answer  meani…    29    29     -4.28    28 1.97e-4 2   e-3 **          
##  4 SDVH  answer  repeat    29    29      1.28    28 2.11e-1 1   e+0 ns          
##  5 SDVH  control meani…    29    29      1.25    28 2.21e-1 1   e+0 ns          
##  6 SDVH  control meani…    29    29     -1.16    28 2.57e-1 1   e+0 ns          
##  7 SDVH  control repeat    29    29      3.89    28 5.7 e-4 6   e-3 **          
##  8 SDVH  meanin… meani…    29    29     -2.73    28 1.1 e-2 1.09e-1 ns          
##  9 SDVH  meanin… repeat    29    29      3.43    28 2   e-3 1.9 e-2 *           
## 10 SDVH  meanin… repeat    29    29      4.85    28 4.19e-5 4.19e-4 ***

3.2.3 SDspeed

## 
## Call:
## lm(formula = SDSpeed ~ condition * beforeafter, data = SDSpeeddata)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.4694 -2.2895 -0.5463  1.0054 18.6664 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           3.23881    0.64181   5.046 8.11e-07 ***
## conditioncontrol                      0.71306    0.90765   0.786   0.4328    
## conditionmeaningfully                 0.23972    0.90765   0.264   0.7919    
## conditionmeaninglessly                0.81206    0.90765   0.895   0.3717    
## conditionrepeat                      -0.31646    0.90765  -0.349   0.7276    
## beforeafteron                         1.77301    0.90765   1.953   0.0518 .  
## conditioncontrol:beforeafteron       -1.60608    1.28361  -1.251   0.2119    
## conditionmeaningfully:beforeafteron  -0.05315    1.28361  -0.041   0.9670    
## conditionmeaninglessly:beforeafteron -0.94991    1.28361  -0.740   0.4599    
## conditionrepeat:beforeafteron         0.58784    1.28361   0.458   0.6473    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.456 on 280 degrees of freedom
## Multiple R-squared:  0.05295,    Adjusted R-squared:  0.02251 
## F-statistic:  1.74 on 9 and 280 DF,  p-value: 0.07996

## Warning in ks.test.default(res_lmmodel, "pnorm", mean(res_lmmodel),
## sd(res_lmmodel)): ties should not be present for the one-sample
## Kolmogorov-Smirnov test
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.15155, p-value = 3.28e-06
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   9  0.3938 0.9376
##       280
## 
## Call:
## lm(formula = log(SDSpeed) ~ condition * beforeafter, data = SDSpeeddata)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.2608 -0.4923  0.1509  0.5566  2.3272 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           0.62800    0.17620   3.564 0.000429 ***
## conditioncontrol                      0.16355    0.24918   0.656 0.512131    
## conditionmeaningfully                 0.16580    0.24918   0.665 0.506341    
## conditionmeaninglessly                0.49093    0.24918   1.970 0.049801 *  
## conditionrepeat                       0.13784    0.24918   0.553 0.580581    
## beforeafteron                         0.75331    0.24918   3.023 0.002733 ** 
## conditioncontrol:beforeafteron       -0.51673    0.35239  -1.466 0.143670    
## conditionmeaningfully:beforeafteron  -0.07457    0.35239  -0.212 0.832561    
## conditionmeaninglessly:beforeafteron -0.51447    0.35239  -1.460 0.145428    
## conditionrepeat:beforeafteron        -0.06010    0.35239  -0.171 0.864704    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9488 on 280 degrees of freedom
## Multiple R-squared:  0.0974, Adjusted R-squared:  0.06839 
## F-statistic: 3.357 on 9 and 280 DF,  p-value: 0.000636

## Warning in ks.test.default(res_lmmodel, "pnorm", mean(res_lmmodel),
## sd(res_lmmodel)): ties should not be present for the one-sample
## Kolmogorov-Smirnov test
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.071556, p-value = 0.1026
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value  Pr(>F)  
## group   9  2.1206 0.02794 *
##       280                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDSpeed ~ condition * beforeafter * agegroup2 + (1 | sub)
##    Data: SDSpeeddata
## 
## REML criterion at convergence: 758.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.5088 -0.4548  0.0742  0.5761  2.4083 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.1737   0.4168  
##  Residual             0.7046   0.8394  
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                                  Estimate Std. Error        df
## (Intercept)                                       0.55884    0.25047 199.70689
## conditioncontrol                                  0.81102    0.31727 243.00000
## conditionmeaningfully                             0.18126    0.31727 243.00000
## conditionmeaninglessly                            0.66972    0.31727 243.00000
## conditionrepeat                                   0.05963    0.31727 243.00000
## beforeafteron                                     0.94604    0.31727 243.00000
## agegroup2Y                                        0.13372    0.34827 199.70689
## conditioncontrol:beforeafteron                   -0.93847    0.44869 243.00000
## conditionmeaningfully:beforeafteron              -0.25804    0.44869 243.00000
## conditionmeaninglessly:beforeafteron             -0.93085    0.44869 243.00000
## conditionrepeat:beforeafteron                    -0.25955    0.44869 243.00000
## conditioncontrol:agegroup2Y                      -1.25178    0.44115 243.00000
## conditionmeaningfully:agegroup2Y                 -0.02988    0.44115 243.00000
## conditionmeaninglessly:agegroup2Y                -0.34566    0.44115 243.00000
## conditionrepeat:agegroup2Y                        0.15121    0.44115 243.00000
## beforeafteron:agegroup2Y                         -0.37262    0.44115 243.00000
## conditioncontrol:beforeafteron:agegroup2Y         0.81535    0.62388 243.00000
## conditionmeaningfully:beforeafteron:agegroup2Y    0.35470    0.62388 243.00000
## conditionmeaninglessly:beforeafteron:agegroup2Y   0.80501    0.62388 243.00000
## conditionrepeat:beforeafteron:agegroup2Y          0.38560    0.62388 243.00000
##                                                 t value Pr(>|t|)   
## (Intercept)                                       2.231  0.02679 * 
## conditioncontrol                                  2.556  0.01119 * 
## conditionmeaningfully                             0.571  0.56832   
## conditionmeaninglessly                            2.111  0.03581 * 
## conditionrepeat                                   0.188  0.85108   
## beforeafteron                                     2.982  0.00316 **
## agegroup2Y                                        0.384  0.70142   
## conditioncontrol:beforeafteron                   -2.092  0.03751 * 
## conditionmeaningfully:beforeafteron              -0.575  0.56576   
## conditionmeaninglessly:beforeafteron             -2.075  0.03908 * 
## conditionrepeat:beforeafteron                    -0.578  0.56349   
## conditioncontrol:agegroup2Y                      -2.838  0.00493 **
## conditionmeaningfully:agegroup2Y                 -0.068  0.94605   
## conditionmeaninglessly:agegroup2Y                -0.784  0.43407   
## conditionrepeat:agegroup2Y                        0.343  0.73208   
## beforeafteron:agegroup2Y                         -0.845  0.39914   
## conditioncontrol:beforeafteron:agegroup2Y         1.307  0.19248   
## conditionmeaningfully:beforeafteron:agegroup2Y    0.569  0.57019   
## conditionmeaninglessly:beforeafteron:agegroup2Y   1.290  0.19816   
## conditionrepeat:beforeafteron:agegroup2Y          0.618  0.53711   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## Type III Analysis of Variance Table with Satterthwaite's method
##                                  Sum Sq Mean Sq NumDF DenDF F value   Pr(>F)
## condition                        3.3554  0.8388     4   243  1.1905 0.315560
## beforeafter                     19.4620 19.4620     1   243 27.6204 3.23e-07
## agegroup2                        0.2609  0.2609     1    27  0.3703 0.547908
## condition:beforeafter            4.0652  1.0163     4   243  1.4423 0.220626
## condition:agegroup2             12.1413  3.0353     4   243  4.3077 0.002195
## beforeafter:agegroup2            0.1793  0.1793     1   243  0.2545 0.614413
## condition:beforeafter:agegroup2  1.7119  0.4280     4   243  0.6074 0.657699
##                                    
## condition                          
## beforeafter                     ***
## agegroup2                          
## condition:beforeafter              
## condition:agegroup2             ** 
## beforeafter:agegroup2              
## condition:beforeafter:agegroup2    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 1 × 10
##   .y.     group1 group2    n1    n2 statistic    df       p   p.adj p.adj.signif
## * <chr>   <chr>  <chr>  <int> <int>     <dbl> <dbl>   <dbl>   <dbl> <chr>       
## 1 SDSpeed befor… on       145   145     -6.15   144 7.16e-9 7.16e-9 ****
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDSpeed ~ condition + (1 | sub)
##    Data: filter.before
## 
## REML criterion at convergence: 435.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9397 -0.3669  0.0825  0.6628  1.8641 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.1585   0.3981  
##  Residual             1.0428   1.0212  
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)   
## (Intercept)              0.6280     0.2035 130.8906   3.086  0.00248 **
## conditioncontrol         0.1636     0.2682 112.0000   0.610  0.54319   
## conditionmeaningfully    0.1658     0.2682 112.0000   0.618  0.53766   
## conditionmeaninglessly   0.4909     0.2682 112.0000   1.831  0.06982 . 
## conditionrepeat          0.1378     0.2682 112.0000   0.514  0.60827   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.659                             
## cndtnmnngfl -0.659  0.500                      
## cndtnmnngls -0.659  0.500  0.500               
## conditinrpt -0.659  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 3.7889 0.94723     4   112  0.9083 0.4618
## # A tibble: 10 × 10
##    .y.     group1    group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>   <chr>     <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 SDSpeed answer    contr…    29    29  -0.524      28 0.605 1     ns          
##  2 SDSpeed answer    meani…    29    29  -0.536      28 0.596 1     ns          
##  3 SDSpeed answer    meani…    29    29  -2.22       28 0.034 0.344 ns          
##  4 SDSpeed answer    repeat    29    29  -0.492      28 0.627 1     ns          
##  5 SDSpeed control   meani…    29    29  -0.00703    28 0.994 1     ns          
##  6 SDSpeed control   meani…    29    29  -1.47       28 0.152 1     ns          
##  7 SDSpeed control   repeat    29    29   0.0905     28 0.929 1     ns          
##  8 SDSpeed meaningf… meani…    29    29  -1.39       28 0.175 1     ns          
##  9 SDSpeed meaningf… repeat    29    29   0.107      28 0.915 1     ns          
## 10 SDSpeed meaningl… repeat    29    29   1.70       28 0.1   1     ns
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDSpeed ~ condition + (1 | sub)
##    Data: filter.during
## 
## REML criterion at convergence: 332.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.9679 -0.4839  0.1730  0.5953  2.0414 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.1314   0.3626  
##  Residual             0.4679   0.6840  
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)              1.38131    0.14376 117.40883   9.609   <2e-16 ***
## conditioncontrol        -0.35318    0.17963 112.00000  -1.966   0.0518 .  
## conditionmeaningfully    0.09123    0.17963 112.00000   0.508   0.6125    
## conditionmeaninglessly  -0.02354    0.17963 112.00000  -0.131   0.8960    
## conditionrepeat          0.07774    0.17963 112.00000   0.433   0.6660    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.625                             
## cndtnmnngfl -0.625  0.500                      
## cndtnmnngls -0.625  0.500  0.500               
## conditinrpt -0.625  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value  Pr(>F)  
## condition 3.7998 0.94995     4   112  2.0304 0.09493 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 10 × 10
##    .y.     group1    group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>   <chr>     <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 SDSpeed answer    contr…    29    29     1.67     28 0.105 1     ns          
##  2 SDSpeed answer    meani…    29    29    -0.632    28 0.532 1     ns          
##  3 SDSpeed answer    meani…    29    29     0.180    28 0.858 1     ns          
##  4 SDSpeed answer    repeat    29    29    -0.599    28 0.554 1     ns          
##  5 SDSpeed control   meani…    29    29    -1.77     28 0.088 0.876 ns          
##  6 SDSpeed control   meani…    29    29    -1.39     28 0.175 1     ns          
##  7 SDSpeed control   repeat    29    29    -1.90     28 0.067 0.673 ns          
##  8 SDSpeed meaningf… meani…    29    29     0.779    28 0.442 1     ns          
##  9 SDSpeed meaningf… repeat    29    29     0.106    28 0.916 1     ns          
## 10 SDSpeed meaningl… repeat    29    29    -0.823    28 0.418 1     ns

3.3 Physiological indicators

3.3.1 SCL (skin conductance level extracted from electrodermal activity (EDA))

## 
## Call:
## lm(formula = SCL ~ condition * beforeafter, data = SCLdata)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.2870 -0.3534 -0.0619  0.1784  3.1828 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           1.16091    0.11472  10.119  < 2e-16 ***
## conditioncontrol                     -0.06518    0.16225  -0.402 0.688196    
## conditionmeaningfully                 0.10921    0.16225   0.673 0.501444    
## conditionmeaninglessly               -0.13121    0.16225  -0.809 0.419368    
## conditionrepeat                      -0.07328    0.16225  -0.452 0.651884    
## beforeafteron                         0.82918    0.16225   5.111 5.95e-07 ***
## conditioncontrol:beforeafteron       -0.90331    0.22945  -3.937 0.000104 ***
## conditionmeaningfully:beforeafteron  -0.45642    0.22945  -1.989 0.047653 *  
## conditionmeaninglessly:beforeafteron -0.71217    0.22945  -3.104 0.002106 ** 
## conditionrepeat:beforeafteron        -0.11845    0.22945  -0.516 0.606109    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6178 on 280 degrees of freedom
## Multiple R-squared:  0.2327, Adjusted R-squared:  0.208 
## F-statistic: 9.433 on 9 and 280 DF,  p-value: 1.543e-12

## Warning in ks.test.default(res_lmmodel, "pnorm", mean(res_lmmodel),
## sd(res_lmmodel)): ties should not be present for the one-sample
## Kolmogorov-Smirnov test
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.16347, p-value = 3.711e-07
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value    Pr(>F)    
## group   9  4.3732 2.344e-05 ***
##       280                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SCL ~ condition * beforeafter * agegroup2 + (1 | sub)
##    Data: SCLdata
## 
## REML criterion at convergence: 557.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9498 -0.5555 -0.0550  0.2955  4.9685 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.02987  0.1728  
##  Residual             0.35657  0.5971  
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                                  Estimate Std. Error        df
## (Intercept)                                       1.24679    0.16614 256.22060
## conditioncontrol                                 -0.27489    0.22570 243.00000
## conditionmeaningfully                             0.15149    0.22570 243.00000
## conditionmeaninglessly                           -0.18256    0.22570 243.00000
## conditionrepeat                                  -0.23172    0.22570 243.00000
## beforeafteron                                     0.84353    0.22570 243.00000
## agegroup2Y                                       -0.16604    0.23101 256.22060
## conditioncontrol:beforeafteron                   -0.84058    0.31918 243.00000
## conditionmeaningfully:beforeafteron              -0.51503    0.31918 243.00000
## conditionmeaninglessly:beforeafteron             -0.74198    0.31918 243.00000
## conditionrepeat:beforeafteron                    -0.22876    0.31918 243.00000
## conditioncontrol:agegroup2Y                       0.40545    0.31382 243.00000
## conditionmeaningfully:agegroup2Y                 -0.08175    0.31382 243.00000
## conditionmeaninglessly:agegroup2Y                 0.09928    0.31382 243.00000
## conditionrepeat:agegroup2Y                        0.30633    0.31382 243.00000
## beforeafteron:agegroup2Y                         -0.02774    0.31382 243.00000
## conditioncontrol:beforeafteron:agegroup2Y        -0.12130    0.44380 243.00000
## conditionmeaningfully:beforeafteron:agegroup2Y    0.11332    0.44380 243.00000
## conditionmeaninglessly:beforeafteron:agegroup2Y   0.05762    0.44380 243.00000
## conditionrepeat:beforeafteron:agegroup2Y          0.21327    0.44380 243.00000
##                                                 t value Pr(>|t|)    
## (Intercept)                                       7.504 1.02e-12 ***
## conditioncontrol                                 -1.218 0.224411    
## conditionmeaningfully                             0.671 0.502715    
## conditionmeaninglessly                           -0.809 0.419369    
## conditionrepeat                                  -1.027 0.305586    
## beforeafteron                                     3.737 0.000232 ***
## agegroup2Y                                       -0.719 0.472959    
## conditioncontrol:beforeafteron                   -2.634 0.008992 ** 
## conditionmeaningfully:beforeafteron              -1.614 0.107912    
## conditionmeaninglessly:beforeafteron             -2.325 0.020917 *  
## conditionrepeat:beforeafteron                    -0.717 0.474250    
## conditioncontrol:agegroup2Y                       1.292 0.197584    
## conditionmeaningfully:agegroup2Y                 -0.261 0.794688    
## conditionmeaninglessly:agegroup2Y                 0.316 0.751990    
## conditionrepeat:agegroup2Y                        0.976 0.329970    
## beforeafteron:agegroup2Y                         -0.088 0.929644    
## conditioncontrol:beforeafteron:agegroup2Y        -0.273 0.784849    
## conditionmeaningfully:beforeafteron:agegroup2Y    0.255 0.798681    
## conditionmeaninglessly:beforeafteron:agegroup2Y   0.130 0.896803    
## conditionrepeat:beforeafteron:agegroup2Y          0.481 0.631276    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## Type III Analysis of Variance Table with Satterthwaite's method
##                                  Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)
## condition                       12.9560  3.2390     4   243  9.0838 7.453e-07
## beforeafter                     11.0528 11.0528     1   243 30.9976 6.822e-08
## agegroup2                        0.0024  0.0024     1    27  0.0066 0.9356637
## condition:beforeafter            8.4337  2.1084     4   243  5.9131 0.0001479
## condition:agegroup2              2.2923  0.5731     4   243  1.6072 0.1730818
## beforeafter:agegroup2            0.0112  0.0112     1   243  0.0313 0.8596271
## condition:beforeafter:agegroup2  0.2264  0.0566     4   243  0.1587 0.9588952
##                                    
## condition                       ***
## beforeafter                     ***
## agegroup2                          
## condition:beforeafter           ***
## condition:agegroup2                
## beforeafter:agegroup2              
## condition:beforeafter:agegroup2    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 10 × 10
##    .y.   group1  group2    n1    n2 statistic    df       p   p.adj p.adj.signif
##  * <chr> <chr>   <chr>  <int> <int>     <dbl> <dbl>   <dbl>   <dbl> <chr>       
##  1 SCL   answer  contr…    58    58    4.66      57 1.98e-5 1.98e-4 ***         
##  2 SCL   answer  meani…    58    58    0.957     57 3.43e-1 1   e+0 ns          
##  3 SCL   answer  meani…    58    58    4.34      57 5.80e-5 5.8 e-4 ***         
##  4 SCL   answer  repeat    58    58    1.30      57 1.98e-1 1   e+0 ns          
##  5 SCL   control meani…    58    58   -3.28      57 2   e-3 1.8 e-2 *           
##  6 SCL   control meani…    58    58   -0.406     57 6.86e-1 1   e+0 ns          
##  7 SCL   control repeat    58    58   -3.55      57 7.72e-4 8   e-3 **          
##  8 SCL   meanin… meani…    58    58    2.69      57 9   e-3 9.2 e-2 ns          
##  9 SCL   meanin… repeat    58    58    0.0873    57 9.31e-1 1   e+0 ns          
## 10 SCL   meanin… repeat    58    58   -3.19      57 2   e-3 2.3 e-2 *
## # A tibble: 1 × 10
##   .y.   group1 group2    n1    n2 statistic    df        p    p.adj p.adj.signif
## * <chr> <chr>  <chr>  <int> <int>     <dbl> <dbl>    <dbl>    <dbl> <chr>       
## 1 SCL   befor… on       145   145     -6.91   144 1.41e-10 1.41e-10 ****
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SCL ~ condition + (1 | sub)
##    Data: filter1.before
## 
## REML criterion at convergence: 203.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.1254 -0.4916 -0.0964  0.2438  5.7312 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.006914 0.08315 
##  Residual             0.216155 0.46492 
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)              1.16091    0.08770 139.46402  13.237   <2e-16 ***
## conditioncontrol        -0.06518    0.12210 112.00000  -0.534    0.595    
## conditionmeaningfully    0.10921    0.12210 112.00000   0.894    0.373    
## conditionmeaninglessly  -0.13121    0.12210 112.00000  -1.075    0.285    
## conditionrepeat         -0.07328    0.12210 112.00000  -0.600    0.550    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.696                             
## cndtnmnngfl -0.696  0.500                      
## cndtnmnngls -0.696  0.500  0.500               
## conditinrpt -0.696  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 0.97469 0.24367     4   112  1.1273 0.3473
## # A tibble: 10 × 10
##    .y.   group1      group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr> <chr>       <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 SCL   answer      contr…    29    29    0.588     28 0.561     1 ns          
##  2 SCL   answer      meani…    29    29   -0.864     28 0.395     1 ns          
##  3 SCL   answer      meani…    29    29    1.32      28 0.197     1 ns          
##  4 SCL   answer      repeat    29    29    0.786     28 0.438     1 ns          
##  5 SCL   control     meani…    29    29   -1.17      28 0.252     1 ns          
##  6 SCL   control     meani…    29    29    0.607     28 0.549     1 ns          
##  7 SCL   control     repeat    29    29    0.0889    28 0.93      1 ns          
##  8 SCL   meaningful… meani…    29    29    1.48      28 0.151     1 ns          
##  9 SCL   meaningful… repeat    29    29    1.21      28 0.238     1 ns          
## 10 SCL   meaningles… repeat    29    29   -0.565     28 0.577     1 ns
## ANOVA Table (type III tests)
## 
## $ANOVA
##      Effect DFn DFd    F        p p<.05   ges
## 1 condition   4 112 9.79 7.92e-07     * 0.212
## 
## $`Mauchly's Test for Sphericity`
##      Effect     W        p p<.05
## 1 condition 0.292 0.000168     *
## 
## $`Sphericity Corrections`
##      Effect   GGe      DF[GG]    p[GG] p[GG]<.05   HFe      DF[HF]    p[HF]
## 1 condition 0.679 2.72, 76.07 2.93e-05         * 0.759 3.04, 85.03 1.19e-05
##   p[HF]<.05
## 1         *
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SCL ~ condition + (1 | sub)
##    Data: filter1.on
## 
## REML criterion at convergence: 327.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.7642 -0.6484 -0.0919  0.3802  4.3435 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.02093  0.1447  
##  Residual             0.51938  0.7207  
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                        Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)              1.9901     0.1365 139.1646  14.580  < 2e-16 ***
## conditioncontrol        -0.9685     0.1893 112.0000  -5.117 1.30e-06 ***
## conditionmeaningfully   -0.3472     0.1893 112.0000  -1.835   0.0692 .  
## conditionmeaninglessly  -0.8434     0.1893 112.0000  -4.456 1.99e-05 ***
## conditionrepeat         -0.1917     0.1893 112.0000  -1.013   0.3132    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.693                             
## cndtnmnngfl -0.693  0.500                      
## cndtnmnngls -0.693  0.500  0.500               
## conditinrpt -0.693  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## condition 20.338  5.0846     4   112  9.7897 7.916e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 10 × 10
##    .y.   group1  group2    n1    n2 statistic    df       p   p.adj p.adj.signif
##  * <chr> <chr>   <chr>  <int> <int>     <dbl> <dbl>   <dbl>   <dbl> <chr>       
##  1 SCL   answer  contr…    29    29     6.34     28 7.34e-7 7.34e-6 ****        
##  2 SCL   answer  meani…    29    29     1.67     28 1.06e-1 1   e+0 ns          
##  3 SCL   answer  meani…    29    29     4.69     28 6.41e-5 6.41e-4 ***         
##  4 SCL   answer  repeat    29    29     1.05     28 3.02e-1 1   e+0 ns          
##  5 SCL   control meani…    29    29    -3.36     28 2   e-3 2.3 e-2 *           
##  6 SCL   control meani…    29    29    -1.31     28 2   e-1 1   e+0 ns          
##  7 SCL   control repeat    29    29    -4.62     28 7.93e-5 7.93e-4 ***         
##  8 SCL   meanin… meani…    29    29     2.25     28 3.2 e-2 3.21e-1 ns          
##  9 SCL   meanin… repeat    29    29    -0.578    28 5.68e-1 1   e+0 ns          
## 10 SCL   meanin… repeat    29    29    -3.56     28 1   e-3 1.4 e-2 *

3.3.2 SDNN (Standard Deviation of Normal-to-Normal intervals (SDNN) extracted from photoplethysmography (PPG))

## 
## Call:
## lm(formula = SDNN ~ condition * beforeafter, data = SDNNdata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.11223 -0.28458 -0.07324  0.20317  2.08571 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           0.98759    0.08945  11.041  < 2e-16 ***
## conditioncontrol                      0.22687    0.12649   1.794 0.073970 .  
## conditionmeaningfully                 0.15543    0.12649   1.229 0.220201    
## conditionmeaninglessly                0.24946    0.12649   1.972 0.049581 *  
## conditionrepeat                       0.03465    0.12649   0.274 0.784363    
## beforeafteron                         0.49388    0.12649   3.904 0.000118 ***
## conditioncontrol:beforeafteron       -0.69561    0.17889  -3.888 0.000126 ***
## conditionmeaningfully:beforeafteron  -0.32284    0.17889  -1.805 0.072195 .  
## conditionmeaninglessly:beforeafteron -0.38292    0.17889  -2.141 0.033174 *  
## conditionrepeat:beforeafteron         0.13400    0.17889   0.749 0.454447    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4817 on 280 degrees of freedom
## Multiple R-squared:  0.1568, Adjusted R-squared:  0.1297 
## F-statistic: 5.784 on 9 and 280 DF,  p-value: 2.213e-07

## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.10486, p-value = 0.003398
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value   Pr(>F)   
## group   9  3.1087 0.001401 **
##       280                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call:
## lm(formula = log(SDNN) ~ condition * beforeafter, data = SDNNdata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.28527 -0.21733 -0.00321  0.21114  0.98281 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                          -0.04754    0.06560  -0.725 0.469231    
## conditioncontrol                      0.16078    0.09277   1.733 0.084201 .  
## conditionmeaningfully                 0.13091    0.09277   1.411 0.159351    
## conditionmeaninglessly                0.22165    0.09277   2.389 0.017552 *  
## conditionrepeat                       0.01976    0.09277   0.213 0.831491    
## beforeafteron                         0.33651    0.09277   3.627 0.000340 ***
## conditioncontrol:beforeafteron       -0.48478    0.13120  -3.695 0.000265 ***
## conditionmeaningfully:beforeafteron  -0.20253    0.13120  -1.544 0.123808    
## conditionmeaninglessly:beforeafteron -0.27021    0.13120  -2.060 0.040369 *  
## conditionrepeat:beforeafteron         0.10981    0.13120   0.837 0.403332    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3533 on 280 degrees of freedom
## Multiple R-squared:  0.1513, Adjusted R-squared:  0.124 
## F-statistic: 5.546 on 9 and 280 DF,  p-value: 4.865e-07

## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.041983, p-value = 0.6862
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   9  1.4177   0.18
##       280
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDNN ~ condition * beforeafter * agegroup2 + (1 | sub)
##    Data: SDNNdata
## 
## REML criterion at convergence: 258.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5096 -0.6263 -0.0239  0.5951  2.8714 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.01042  0.1021  
##  Residual             0.11739  0.3426  
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                                  Estimate Std. Error        df
## (Intercept)                                      -0.07576    0.09555 254.76274
## conditioncontrol                                  0.13520    0.12950 243.00000
## conditionmeaningfully                             0.08089    0.12950 243.00000
## conditionmeaninglessly                            0.24911    0.12950 243.00000
## conditionrepeat                                   0.11007    0.12950 243.00000
## beforeafteron                                     0.35618    0.12950 243.00000
## agegroup2Y                                        0.05456    0.13285 254.76274
## conditioncontrol:beforeafteron                   -0.42650    0.18314 243.00000
## conditionmeaningfully:beforeafteron              -0.17411    0.18314 243.00000
## conditionmeaninglessly:beforeafteron             -0.31872    0.18314 243.00000
## conditionrepeat:beforeafteron                     0.02315    0.18314 243.00000
## conditioncontrol:agegroup2Y                       0.04945    0.18006 243.00000
## conditionmeaningfully:agegroup2Y                  0.09670    0.18006 243.00000
## conditionmeaninglessly:agegroup2Y                -0.05310    0.18006 243.00000
## conditionrepeat:agegroup2Y                       -0.17459    0.18006 243.00000
## beforeafteron:agegroup2Y                         -0.03802    0.18006 243.00000
## conditioncontrol:beforeafteron:agegroup2Y        -0.11268    0.25464 243.00000
## conditionmeaningfully:beforeafteron:agegroup2Y   -0.05494    0.25464 243.00000
## conditionmeaninglessly:beforeafteron:agegroup2Y   0.09379    0.25464 243.00000
## conditionrepeat:beforeafteron:agegroup2Y          0.16755    0.25464 243.00000
##                                                 t value Pr(>|t|)   
## (Intercept)                                      -0.793   0.4285   
## conditioncontrol                                  1.044   0.2975   
## conditionmeaningfully                             0.625   0.5328   
## conditionmeaninglessly                            1.924   0.0556 . 
## conditionrepeat                                   0.850   0.3962   
## beforeafteron                                     2.750   0.0064 **
## agegroup2Y                                        0.411   0.6816   
## conditioncontrol:beforeafteron                   -2.329   0.0207 * 
## conditionmeaningfully:beforeafteron              -0.951   0.3427   
## conditionmeaninglessly:beforeafteron             -1.740   0.0831 . 
## conditionrepeat:beforeafteron                     0.126   0.8995   
## conditioncontrol:agegroup2Y                       0.275   0.7838   
## conditionmeaningfully:agegroup2Y                  0.537   0.5917   
## conditionmeaninglessly:agegroup2Y                -0.295   0.7683   
## conditionrepeat:agegroup2Y                       -0.970   0.3332   
## beforeafteron:agegroup2Y                         -0.211   0.8329   
## conditioncontrol:beforeafteron:agegroup2Y        -0.443   0.6585   
## conditionmeaningfully:beforeafteron:agegroup2Y   -0.216   0.8293   
## conditionmeaninglessly:beforeafteron:agegroup2Y   0.368   0.7130   
## conditionrepeat:beforeafteron:agegroup2Y          0.658   0.5112   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## Type III Analysis of Variance Table with Satterthwaite's method
##                                  Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)
## condition                       1.06345 0.26586     4   243  2.2648   0.06285
## beforeafter                     2.02680 2.02680     1   243 17.2657 4.505e-05
## agegroup2                       0.03140 0.03140     1    27  0.2675   0.60924
## condition:beforeafter           3.11118 0.77779     4   243  6.6258 4.466e-05
## condition:agegroup2             0.18661 0.04665     4   243  0.3974   0.81041
## beforeafter:agegroup2           0.00673 0.00673     1   243  0.0573   0.81095
## condition:beforeafter:agegroup2 0.18403 0.04601     4   243  0.3919   0.81433
##                                    
## condition                       .  
## beforeafter                     ***
## agegroup2                          
## condition:beforeafter           ***
## condition:agegroup2                
## beforeafter:agegroup2              
## condition:beforeafter:agegroup2    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Type III Analysis of Variance Table with Satterthwaite's method
##                                  Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)
## condition                       1.06345 0.26586     4   243  2.2648   0.06285
## beforeafter                     2.02680 2.02680     1   243 17.2657 4.505e-05
## agegroup2                       0.03140 0.03140     1    27  0.2675   0.60924
## condition:beforeafter           3.11118 0.77779     4   243  6.6258 4.466e-05
## condition:agegroup2             0.18661 0.04665     4   243  0.3974   0.81041
## beforeafter:agegroup2           0.00673 0.00673     1   243  0.0573   0.81095
## condition:beforeafter:agegroup2 0.18403 0.04601     4   243  0.3919   0.81433
##                                    
## condition                       .  
## beforeafter                     ***
## agegroup2                          
## condition:beforeafter           ***
## condition:agegroup2                
## beforeafter:agegroup2              
## condition:beforeafter:agegroup2    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 1 × 10
##   .y.   group1   group2    n1    n2 statistic    df       p   p.adj p.adj.signif
## * <chr> <chr>    <chr>  <int> <int>     <dbl> <dbl>   <dbl>   <dbl> <chr>       
## 1 SDNN  beforei… on       145   145     -4.95   144 2.02e-6 2.02e-6 ****
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDNN ~ condition + (1 | sub)
##    Data: filter1.before
## 
## REML criterion at convergence: 96.8
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.85755 -0.57963 -0.01298  0.61145  2.91512 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.001433 0.03785 
##  Residual             0.102264 0.31979 
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)   
## (Intercept)             -0.04754    0.05980 139.89315  -0.795  0.42793   
## conditioncontrol         0.16078    0.08398 112.00000   1.914  0.05811 . 
## conditionmeaningfully    0.13091    0.08398 112.00000   1.559  0.12187   
## conditionmeaninglessly   0.22165    0.08398 112.00000   2.639  0.00949 **
## conditionrepeat          0.01976    0.08398 112.00000   0.235  0.81441   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.702                             
## cndtnmnngfl -0.702  0.500                      
## cndtnmnngls -0.702  0.500  0.500               
## conditinrpt -0.702  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value  Pr(>F)  
## condition 1.0343 0.25858     4   112  2.5286 0.04451 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 10 × 10
##    .y.   group1      group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr> <chr>       <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 SDNN  answer      contr…    29    29    -1.88     28 0.07  0.701 ns          
##  2 SDNN  answer      meani…    29    29    -1.73     28 0.095 0.954 ns          
##  3 SDNN  answer      meani…    29    29    -2.64     28 0.013 0.133 ns          
##  4 SDNN  answer      repeat    29    29    -0.260    28 0.797 1     ns          
##  5 SDNN  control     meani…    29    29     0.337    28 0.739 1     ns          
##  6 SDNN  control     meani…    29    29    -0.667    28 0.51  1     ns          
##  7 SDNN  control     repeat    29    29     1.51     28 0.142 1     ns          
##  8 SDNN  meaningful… meani…    29    29    -1.15     28 0.26  1     ns          
##  9 SDNN  meaningful… repeat    29    29     1.38     28 0.178 1     ns          
## 10 SDNN  meaningles… repeat    29    29     2.40     28 0.023 0.234 ns
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDNN ~ condition + (1 | sub)
##    Data: filter1.on
## 
## REML criterion at convergence: 144.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.2811 -0.6132 -0.0445  0.5824  2.6031 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.005948 0.07713 
##  Residual             0.139960 0.37411 
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)              0.28897    0.07093 139.07542   4.074 7.73e-05 ***
## conditioncontrol        -0.32400    0.09825 112.00000  -3.298  0.00131 ** 
## conditionmeaningfully   -0.07162    0.09825 112.00000  -0.729  0.46752    
## conditionmeaninglessly  -0.04857    0.09825 112.00000  -0.494  0.62204    
## conditionrepeat          0.12957    0.09825 112.00000   1.319  0.18992    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.693                             
## cndtnmnngfl -0.693  0.500                      
## cndtnmnngls -0.693  0.500  0.500               
## conditinrpt -0.693  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## condition 3.1743 0.79357     4   112    5.67 0.0003416 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 10 × 10
##    .y.   group1    group2    n1    n2 statistic    df       p p.adj p.adj.signif
##  * <chr> <chr>     <chr>  <int> <int>     <dbl> <dbl>   <dbl> <dbl> <chr>       
##  1 SDNN  answer    contr…    29    29     2.92     28 7   e-3 0.069 ns          
##  2 SDNN  answer    meani…    29    29     0.816    28 4.21e-1 1     ns          
##  3 SDNN  answer    meani…    29    29     0.438    28 6.65e-1 1     ns          
##  4 SDNN  answer    repeat    29    29    -1.29     28 2.07e-1 1     ns          
##  5 SDNN  control   meani…    29    29    -3.16     28 4   e-3 0.037 *           
##  6 SDNN  control   meani…    29    29    -3.10     28 4   e-3 0.044 *           
##  7 SDNN  control   repeat    29    29    -3.86     28 6.04e-4 0.006 **          
##  8 SDNN  meaningf… meani…    29    29    -0.283    28 7.79e-1 1     ns          
##  9 SDNN  meaningf… repeat    29    29    -2.11     28 4.4 e-2 0.44  ns          
## 10 SDNN  meaningl… repeat    29    29    -1.75     28 9.1 e-2 0.909 ns

3.3.3 Breathing rate

## 
## Call:
## lm(formula = RESP ~ condition * beforeafter, data = RESPdata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.93300 -0.13385 -0.00261  0.11281  1.42227 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           0.91290    0.04784  19.081  < 2e-16 ***
## conditioncontrol                      0.11058    0.06766   1.634  0.10331    
## conditionmeaningfully                 0.11154    0.06766   1.649  0.10037    
## conditionmeaninglessly                0.10177    0.06766   1.504  0.13368    
## conditionrepeat                       0.18376    0.06766   2.716  0.00702 ** 
## beforeafteron                         0.04912    0.06766   0.726  0.46851    
## conditioncontrol:beforeafteron       -0.06190    0.09569  -0.647  0.51820    
## conditionmeaningfully:beforeafteron  -0.12551    0.09569  -1.312  0.19071    
## conditionmeaninglessly:beforeafteron -0.11834    0.09569  -1.237  0.21722    
## conditionrepeat:beforeafteron        -0.04082    0.09569  -0.427  0.67004    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2577 on 280 degrees of freedom
## Multiple R-squared:  0.05368,    Adjusted R-squared:  0.02326 
## F-statistic: 1.765 on 9 and 280 DF,  p-value: 0.07481

## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.11272, p-value = 0.00126
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   9  1.3775 0.1979
##       280
## 
## Call:
## lm(formula = log(RESP) ~ condition * beforeafter, data = RESPdata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.79285 -0.11205  0.02751  0.13633  0.89478 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)  
## (Intercept)                          -0.12078    0.05298  -2.280   0.0234 *
## conditioncontrol                      0.12720    0.07492   1.698   0.0907 .
## conditionmeaningfully                 0.12467    0.07492   1.664   0.0972 .
## conditionmeaninglessly                0.10573    0.07492   1.411   0.1593  
## conditionrepeat                       0.15969    0.07492   2.131   0.0339 *
## beforeafteron                         0.04555    0.07492   0.608   0.5437  
## conditioncontrol:beforeafteron       -0.06159    0.10595  -0.581   0.5615  
## conditionmeaningfully:beforeafteron  -0.14861    0.10595  -1.403   0.1619  
## conditionmeaninglessly:beforeafteron -0.10577    0.10595  -0.998   0.3190  
## conditionrepeat:beforeafteron        -0.05212    0.10595  -0.492   0.6231  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2853 on 280 degrees of freedom
## Multiple R-squared:  0.03541,    Adjusted R-squared:  0.004407 
## F-statistic: 1.142 on 9 and 280 DF,  p-value: 0.3329

## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.124, p-value = 0.0002678
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   9  0.7143 0.6957
##       280
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RESP ~ condition * beforeafter * agegroup2 + (1 | sub)
##    Data: RESPdata
## 
## REML criterion at convergence: 126.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.7583 -0.3806  0.0754  0.5531  3.3718 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.01330  0.1153  
##  Residual             0.06901  0.2627  
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                                   Estimate Std. Error
## (Intercept)                                      -0.122394   0.076677
## conditioncontrol                                  0.125243   0.099292
## conditionmeaningfully                             0.121261   0.099292
## conditionmeaninglessly                            0.054179   0.099292
## conditionrepeat                                   0.130165   0.099292
## beforeafteron                                     0.105056   0.099292
## agegroup2Y                                        0.003128   0.106615
## conditioncontrol:beforeafteron                   -0.146273   0.140420
## conditionmeaningfully:beforeafteron              -0.120484   0.140420
## conditionmeaninglessly:beforeafteron             -0.110818   0.140420
## conditionrepeat:beforeafteron                    -0.158310   0.140420
## conditioncontrol:agegroup2Y                       0.003784   0.138060
## conditionmeaningfully:agegroup2Y                  0.006593   0.138060
## conditionmeaninglessly:agegroup2Y                 0.099667   0.138060
## conditionrepeat:agegroup2Y                        0.057085   0.138060
## beforeafteron:agegroup2Y                         -0.115041   0.138060
## conditioncontrol:beforeafteron:agegroup2Y         0.163710   0.195246
## conditionmeaningfully:beforeafteron:agegroup2Y   -0.054370   0.195246
## conditionmeaninglessly:beforeafteron:agegroup2Y   0.009764   0.195246
## conditionrepeat:beforeafteron:agegroup2Y          0.205291   0.195246
##                                                         df t value Pr(>|t|)
## (Intercept)                                     218.635364  -1.596    0.112
## conditioncontrol                                243.000001   1.261    0.208
## conditionmeaningfully                           243.000001   1.221    0.223
## conditionmeaninglessly                          243.000001   0.546    0.586
## conditionrepeat                                 243.000001   1.311    0.191
## beforeafteron                                   243.000001   1.058    0.291
## agegroup2Y                                      218.635364   0.029    0.977
## conditioncontrol:beforeafteron                  243.000001  -1.042    0.299
## conditionmeaningfully:beforeafteron             243.000001  -0.858    0.392
## conditionmeaninglessly:beforeafteron            243.000001  -0.789    0.431
## conditionrepeat:beforeafteron                   243.000001  -1.127    0.261
## conditioncontrol:agegroup2Y                     243.000001   0.027    0.978
## conditionmeaningfully:agegroup2Y                243.000001   0.048    0.962
## conditionmeaninglessly:agegroup2Y               243.000001   0.722    0.471
## conditionrepeat:agegroup2Y                      243.000001   0.413    0.680
## beforeafteron:agegroup2Y                        243.000001  -0.833    0.406
## conditioncontrol:beforeafteron:agegroup2Y       243.000001   0.838    0.403
## conditionmeaningfully:beforeafteron:agegroup2Y  243.000001  -0.278    0.781
## conditionmeaninglessly:beforeafteron:agegroup2Y 243.000001   0.050    0.960
## conditionrepeat:beforeafteron:agegroup2Y        243.000001   1.051    0.294
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## Type III Analysis of Variance Table with Satterthwaite's method
##                                  Sum Sq  Mean Sq NumDF DenDF F value  Pr(>F)  
## condition                       0.57105 0.142762     4   243  2.0686 0.08554 .
## beforeafter                     0.05358 0.053581     1   243  0.7764 0.37911  
## agegroup2                       0.00326 0.003256     1    27  0.0472 0.82967  
## condition:beforeafter           0.17884 0.044710     4   243  0.6478 0.62891  
## condition:agegroup2             0.32602 0.081506     4   243  1.1810 0.31971  
## beforeafter:agegroup2           0.04555 0.045552     1   243  0.6600 0.41734  
## condition:beforeafter:agegroup2 0.18448 0.046119     4   243  0.6683 0.61458  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.4 Eye movement indicators

3.4.1 Pupil diameter (PD)

## 
## Call:
## lm(formula = PD ~ condition * beforeafter, data = PDdata)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.167581 -0.049885  0.000388  0.041872  0.304631 
## 
## Coefficients:
##                                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           0.999013   0.013789  72.451  < 2e-16 ***
## conditioncontrol                      0.002304   0.019500   0.118    0.906    
## conditionmeaningfully                -0.001545   0.019500  -0.079    0.937    
## conditionmeaninglessly                0.011311   0.019500   0.580    0.562    
## conditionrepeat                      -0.008317   0.019500  -0.427    0.670    
## beforeafteron                         0.125300   0.019500   6.426 5.63e-10 ***
## conditioncontrol:beforeafteron       -0.129992   0.027578  -4.714 3.84e-06 ***
## conditionmeaningfully:beforeafteron  -0.113723   0.027578  -4.124 4.92e-05 ***
## conditionmeaninglessly:beforeafteron -0.136238   0.027578  -4.940 1.34e-06 ***
## conditionrepeat:beforeafteron        -0.037815   0.027578  -1.371    0.171    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07426 on 280 degrees of freedom
## Multiple R-squared:  0.2485, Adjusted R-squared:  0.2243 
## F-statistic: 10.29 on 9 and 280 DF,  p-value: 1.042e-13

## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.036975, p-value = 0.8227
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   9  0.6456 0.7576
##       280
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: PD ~ agegroup2 * condition * beforeafter + (1 | sub)
##    Data: PDdata
## 
## REML criterion at convergence: -611
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.1952 -0.5610  0.0032  0.6031  3.9362 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.001258 0.03547 
##  Residual             0.004362 0.06605 
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                                   Estimate Std. Error
## (Intercept)                                      9.994e-01  2.004e-02
## agegroup2Y                                      -6.955e-04  2.786e-02
## conditioncontrol                                -1.054e-02  2.496e-02
## conditionmeaningfully                            1.781e-03  2.496e-02
## conditionmeaninglessly                           1.882e-02  2.496e-02
## conditionrepeat                                 -2.135e-02  2.496e-02
## beforeafteron                                    1.257e-01  2.496e-02
## agegroup2Y:conditioncontrol                      2.484e-02  3.471e-02
## agegroup2Y:conditionmeaningfully                -6.429e-03  3.471e-02
## agegroup2Y:conditionmeaninglessly               -1.452e-02  3.471e-02
## agegroup2Y:conditionrepeat                       2.519e-02  3.471e-02
## agegroup2Y:beforeafteron                        -8.193e-04  3.471e-02
## conditioncontrol:beforeafteron                  -1.167e-01  3.530e-02
## conditionmeaningfully:beforeafteron             -1.233e-01  3.530e-02
## conditionmeaninglessly:beforeafteron            -1.211e-01  3.530e-02
## conditionrepeat:beforeafteron                   -2.537e-02  3.530e-02
## agegroup2Y:conditioncontrol:beforeafteron       -2.574e-02  4.909e-02
## agegroup2Y:conditionmeaningfully:beforeafteron   1.845e-02  4.909e-02
## agegroup2Y:conditionmeaninglessly:beforeafteron -2.927e-02  4.909e-02
## agegroup2Y:conditionrepeat:beforeafteron        -2.406e-02  4.909e-02
##                                                         df t value Pr(>|t|)    
## (Intercept)                                      1.861e+02  49.877  < 2e-16 ***
## agegroup2Y                                       1.861e+02  -0.025 0.980109    
## conditioncontrol                                 2.430e+02  -0.422 0.673113    
## conditionmeaningfully                            2.430e+02   0.071 0.943186    
## conditionmeaninglessly                           2.430e+02   0.754 0.451637    
## conditionrepeat                                  2.430e+02  -0.855 0.393335    
## beforeafteron                                    2.430e+02   5.036 9.26e-07 ***
## agegroup2Y:conditioncontrol                      2.430e+02   0.716 0.474900    
## agegroup2Y:conditionmeaningfully                 2.430e+02  -0.185 0.853204    
## agegroup2Y:conditionmeaninglessly                2.430e+02  -0.418 0.676146    
## agegroup2Y:conditionrepeat                       2.430e+02   0.726 0.468706    
## agegroup2Y:beforeafteron                         2.430e+02  -0.024 0.981188    
## conditioncontrol:beforeafteron                   2.430e+02  -3.305 0.001093 ** 
## conditionmeaningfully:beforeafteron              2.430e+02  -3.492 0.000570 ***
## conditionmeaninglessly:beforeafteron             2.430e+02  -3.430 0.000709 ***
## conditionrepeat:beforeafteron                    2.430e+02  -0.719 0.473034    
## agegroup2Y:conditioncontrol:beforeafteron        2.430e+02  -0.524 0.600549    
## agegroup2Y:conditionmeaningfully:beforeafteron   2.430e+02   0.376 0.707338    
## agegroup2Y:conditionmeaninglessly:beforeafteron  2.430e+02  -0.596 0.551493    
## agegroup2Y:conditionrepeat:beforeafteron         2.430e+02  -0.490 0.624518    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## Type III Analysis of Variance Table with Satterthwaite's method
##                                   Sum Sq  Mean Sq NumDF DenDF F value    Pr(>F)
## agegroup2                       0.000034 0.000034     1    27  0.0078    0.9303
## condition                       0.167015 0.041754     4   243  9.5715 3.339e-07
## beforeafter                     0.127553 0.127553     1   243 29.2399 1.528e-07
## agegroup2:condition             0.017003 0.004251     4   243  0.9744    0.4221
## agegroup2:beforeafter           0.003033 0.003033     1   243  0.6952    0.4052
## condition:beforeafter           0.215486 0.053872     4   243 12.3493 3.701e-09
## agegroup2:condition:beforeafter 0.006168 0.001542     4   243  0.3535    0.8415
##                                    
## agegroup2                          
## condition                       ***
## beforeafter                     ***
## agegroup2:condition                
## agegroup2:beforeafter              
## condition:beforeafter           ***
## agegroup2:condition:beforeafter    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 10 × 10
##    .y.   group1    group2    n1    n2 statistic    df       p p.adj p.adj.signif
##  * <chr> <chr>     <chr>  <int> <int>     <dbl> <dbl>   <dbl> <dbl> <chr>       
##  1 PD    answer    contr…    58    58     4.02     57 1.74e-4 0.002 **          
##  2 PD    answer    meani…    58    58     3.79     57 3.67e-4 0.004 **          
##  3 PD    answer    meani…    58    58     3.80     57 3.56e-4 0.004 **          
##  4 PD    answer    repeat    58    58     2.04     57 4.6 e-2 0.457 ns          
##  5 PD    control   meani…    58    58    -0.385    57 7.02e-1 1     ns          
##  6 PD    control   meani…    58    58    -0.572    57 5.7 e-1 1     ns          
##  7 PD    control   repeat    58    58    -2.67     57 1   e-2 0.1   ns          
##  8 PD    meaningf… meani…    58    58    -0.127    57 8.99e-1 1     ns          
##  9 PD    meaningf… repeat    58    58    -2.71     57 9   e-3 0.088 ns          
## 10 PD    meaningl… repeat    58    58    -2.05     57 4.5 e-2 0.447 ns
## # A tibble: 1 × 10
##   .y.   group1   group2    n1    n2 statistic    df       p   p.adj p.adj.signif
## * <chr> <chr>    <chr>  <int> <int>     <dbl> <dbl>   <dbl>   <dbl> <chr>       
## 1 PD    beforei… on       145   145     -5.48   144 1.88e-7 1.88e-7 ****
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: PD ~ condition + (1 | sub)
##    Data: filter1.before
## 
## REML criterion at convergence: -352.8
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.98686 -0.57781  0.02829  0.59355  2.56295 
## 
## Random effects:
##  Groups   Name        Variance  Std.Dev.
##  sub      (Intercept) 0.0006426 0.02535 
##  Residual             0.0036845 0.06070 
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                          Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)              0.999013   0.012215 128.651048  81.784   <2e-16 ***
## conditioncontrol         0.002304   0.015941 112.000000   0.145    0.885    
## conditionmeaningfully   -0.001545   0.015941 112.000000  -0.097    0.923    
## conditionmeaninglessly   0.011311   0.015941 112.000000   0.710    0.479    
## conditionrepeat         -0.008317   0.015941 112.000000  -0.522    0.603    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.652                             
## cndtnmnngfl -0.652  0.500                      
## cndtnmnngls -0.652  0.500  0.500               
## conditinrpt -0.652  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##              Sum Sq   Mean Sq NumDF DenDF F value Pr(>F)
## condition 0.0058579 0.0014645     4   112  0.3975 0.8101
## # A tibble: 10 × 10
##    .y.   group1      group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr> <chr>       <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 PD    answer      contr…    29    29   -0.134     28 0.894     1 ns          
##  2 PD    answer      meani…    29    29    0.0927    28 0.927     1 ns          
##  3 PD    answer      meani…    29    29   -0.723     28 0.476     1 ns          
##  4 PD    answer      repeat    29    29    0.473     28 0.64      1 ns          
##  5 PD    control     meani…    29    29    0.247     28 0.806     1 ns          
##  6 PD    control     meani…    29    29   -0.597     28 0.555     1 ns          
##  7 PD    control     repeat    29    29    0.715     28 0.481     1 ns          
##  8 PD    meaningful… meani…    29    29   -0.744     28 0.463     1 ns          
##  9 PD    meaningful… repeat    29    29    0.590     28 0.56      1 ns          
## 10 PD    meaningles… repeat    29    29    1.14      28 0.263     1 ns
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: PD ~ condition + (1 | sub)
##    Data: filter1.on
## 
## REML criterion at convergence: -300.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0153 -0.5500 -0.0672  0.5965  3.4668 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.001772 0.0421  
##  Residual             0.004928 0.0702  
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)              1.12431    0.01520 109.39429  73.966  < 2e-16 ***
## conditioncontrol        -0.12769    0.01844 112.00000  -6.926 2.88e-10 ***
## conditionmeaningfully   -0.11527    0.01844 112.00000  -6.252 7.56e-09 ***
## conditionmeaninglessly  -0.12493    0.01844 112.00000  -6.776 6.03e-10 ***
## conditionrepeat         -0.04613    0.01844 112.00000  -2.502   0.0138 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.606                             
## cndtnmnngfl -0.606  0.500                      
## cndtnmnngls -0.606  0.500  0.500               
## conditinrpt -0.606  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF DenDF F value   Pr(>F)    
## condition 0.37828 0.09457     4   112  19.188 4.81e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 10 × 10
##    .y.   group1  group2    n1    n2 statistic    df       p   p.adj p.adj.signif
##  * <chr> <chr>   <chr>  <int> <int>     <dbl> <dbl>   <dbl>   <dbl> <chr>       
##  1 PD    answer  contr…    29    29     6.43     28 5.87e-7 5.87e-6 ****        
##  2 PD    answer  meani…    29    29     5.38     28 9.84e-6 9.84e-5 ****        
##  3 PD    answer  meani…    29    29     6.83     28 2.01e-7 2.01e-6 ****        
##  4 PD    answer  repeat    29    29     2.34     28 2.7 e-2 2.67e-1 ns          
##  5 PD    control meani…    29    29    -0.774    28 4.45e-1 1   e+0 ns          
##  6 PD    control meani…    29    29    -0.194    28 8.48e-1 1   e+0 ns          
##  7 PD    control repeat    29    29    -4.37     28 1.54e-4 2   e-3 **          
##  8 PD    meanin… meani…    29    29     0.529    28 6.01e-1 1   e+0 ns          
##  9 PD    meanin… repeat    29    29    -3.97     28 4.54e-4 5   e-3 **          
## 10 PD    meanin… repeat    29    29    -4.06     28 3.62e-4 4   e-3 **

3.4.2 PVRC (proportion of visit duration on the road centre)

## 
## Call:
## lm(formula = PVRC ~ condition * beforeafter, data = PVRCdata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.76132 -0.17676  0.00025  0.13603  1.66148 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           0.84328    0.06095  13.836   <2e-16 ***
## conditioncontrol                      0.18364    0.08620   2.130   0.0340 *  
## conditionmeaningfully                 0.10292    0.08620   1.194   0.2335    
## conditionmeaninglessly                0.06242    0.08620   0.724   0.4696    
## conditionrepeat                       0.04501    0.08620   0.522   0.6019    
## beforeafteron                         0.15329    0.08620   1.778   0.0764 .  
## conditioncontrol:beforeafteron       -0.30219    0.12190  -2.479   0.0138 *  
## conditionmeaningfully:beforeafteron  -0.09009    0.12190  -0.739   0.4605    
## conditionmeaninglessly:beforeafteron -0.08303    0.12190  -0.681   0.4964    
## conditionrepeat:beforeafteron         0.08218    0.12190   0.674   0.5008    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3282 on 280 degrees of freedom
## Multiple R-squared:  0.05792,    Adjusted R-squared:  0.02764 
## F-statistic: 1.913 on 9 and 280 DF,  p-value: 0.05009

## Warning in ks.test.default(res_lmmodel, "pnorm", mean(res_lmmodel),
## sd(res_lmmodel)): ties should not be present for the one-sample
## Kolmogorov-Smirnov test
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  res_lmmodel
## D = 0.093022, p-value = 0.01323
## alternative hypothesis: two-sided
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   9  0.3091 0.9716
##       280
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: PVRC ~ condition * beforeafter * agegroup2 + (1 | sub)
##    Data: PVRCdata
## 
## REML criterion at convergence: 216.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5205 -0.4645 -0.0257  0.4468  4.7174 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.007596 0.08715 
##  Residual             0.101093 0.31795 
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                                   Estimate Std. Error
## (Intercept)                                       0.826389   0.088111
## conditioncontrol                                  0.113661   0.120175
## conditionmeaningfully                             0.055743   0.120175
## conditionmeaninglessly                            0.029065   0.120175
## conditionrepeat                                   0.009350   0.120175
## beforeafteron                                     0.150082   0.120175
## agegroup2Y                                        0.032664   0.122513
## conditioncontrol:beforeafteron                   -0.251911   0.169952
## conditionmeaningfully:beforeafteron              -0.029725   0.169952
## conditionmeaninglessly:beforeafteron              0.024860   0.169952
## conditionrepeat:beforeafteron                     0.048359   0.169952
## conditioncontrol:agegroup2Y                       0.135291   0.167096
## conditionmeaningfully:agegroup2Y                  0.091219   0.167096
## conditionmeaninglessly:agegroup2Y                 0.064491   0.167096
## conditionrepeat:agegroup2Y                        0.068948   0.167096
## beforeafteron:agegroup2Y                          0.006205   0.167096
## conditioncontrol:beforeafteron:agegroup2Y        -0.097203   0.236309
## conditionmeaningfully:beforeafteron:agegroup2Y   -0.116706   0.236309
## conditionmeaninglessly:beforeafteron:agegroup2Y  -0.208583   0.236309
## conditionrepeat:beforeafteron:agegroup2Y          0.065388   0.236309
##                                                         df t value Pr(>|t|)    
## (Intercept)                                     258.632400   9.379   <2e-16 ***
## conditioncontrol                                243.000000   0.946    0.345    
## conditionmeaningfully                           243.000000   0.464    0.643    
## conditionmeaninglessly                          243.000000   0.242    0.809    
## conditionrepeat                                 243.000000   0.078    0.938    
## beforeafteron                                   243.000000   1.249    0.213    
## agegroup2Y                                      258.632400   0.267    0.790    
## conditioncontrol:beforeafteron                  243.000000  -1.482    0.140    
## conditionmeaningfully:beforeafteron             243.000000  -0.175    0.861    
## conditionmeaninglessly:beforeafteron            243.000000   0.146    0.884    
## conditionrepeat:beforeafteron                   243.000000   0.285    0.776    
## conditioncontrol:agegroup2Y                     243.000000   0.810    0.419    
## conditionmeaningfully:agegroup2Y                243.000000   0.546    0.586    
## conditionmeaninglessly:agegroup2Y               243.000000   0.386    0.700    
## conditionrepeat:agegroup2Y                      243.000000   0.413    0.680    
## beforeafteron:agegroup2Y                        243.000000   0.037    0.970    
## conditioncontrol:beforeafteron:agegroup2Y       243.000000  -0.411    0.681    
## conditionmeaningfully:beforeafteron:agegroup2Y  243.000000  -0.494    0.622    
## conditionmeaninglessly:beforeafteron:agegroup2Y 243.000000  -0.883    0.378    
## conditionrepeat:beforeafteron:agegroup2Y        243.000000   0.277    0.782    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## Type III Analysis of Variance Table with Satterthwaite's method
##                                  Sum Sq Mean Sq NumDF DenDF F value Pr(>F)  
## condition                       0.24789 0.06197     4   243  0.6130 0.6536  
## beforeafter                     0.41596 0.41596     1   243  4.1146 0.0436 *
## agegroup2                       0.21462 0.21462     1    27  2.1230 0.1566  
## condition:beforeafter           1.17304 0.29326     4   243  2.9009 0.0226 *
## condition:agegroup2             0.20174 0.05043     4   243  0.4989 0.7366  
## beforeafter:agegroup2           0.07700 0.07700     1   243  0.7616 0.3837  
## condition:beforeafter:agegroup2 0.16419 0.04105     4   243  0.4060 0.8042  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## # A tibble: 1 × 10
##   .y.   group1       group2    n1    n2 statistic    df     p p.adj p.adj.signif
## * <chr> <chr>        <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
## 1 PVRC  beforeinter… on       145   145     -2.86   144 0.005 0.005 **
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: PVRC ~ condition + (1 | sub)
##    Data: filter1.before
## 
## REML criterion at convergence: 93.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.4045 -0.5141 -0.0425  0.3944  3.7727 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 0.007584 0.08709 
##  Residual             0.094516 0.30743 
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)              0.84328    0.05934 136.97660  14.212   <2e-16 ***
## conditioncontrol         0.18364    0.08074 112.00000   2.275   0.0248 *  
## conditionmeaningfully    0.10292    0.08074 112.00000   1.275   0.2050    
## conditionmeaninglessly   0.06242    0.08074 112.00000   0.773   0.4411    
## conditionrepeat          0.04501    0.08074 112.00000   0.558   0.5783    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.680                             
## cndtnmnngfl -0.680  0.500                      
## cndtnmnngls -0.680  0.500  0.500               
## conditinrpt -0.680  0.500  0.500      0.500
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 0.55658 0.13914     4   112  1.4722 0.2154
## # A tibble: 10 × 10
##    .y.   group1      group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr> <chr>       <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 PVRC  answer      contr…    29    29    -2.13     28 0.042 0.424 ns          
##  2 PVRC  answer      meani…    29    29    -1.31     28 0.201 1     ns          
##  3 PVRC  answer      meani…    29    29    -0.772    28 0.447 1     ns          
##  4 PVRC  answer      repeat    29    29    -0.570    28 0.573 1     ns          
##  5 PVRC  control     meani…    29    29     0.842    28 0.407 1     ns          
##  6 PVRC  control     meani…    29    29     1.51     28 0.143 1     ns          
##  7 PVRC  control     repeat    29    29     1.51     28 0.142 1     ns          
##  8 PVRC  meaningful… meani…    29    29     0.610    28 0.547 1     ns          
##  9 PVRC  meaningful… repeat    29    29     0.818    28 0.421 1     ns          
## 10 PVRC  meaningles… repeat    29    29     0.240    28 0.812 1     ns
## boundary (singular) fit: see help('isSingular')
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: PVRC ~ condition + (1 | sub)
##    Data: filter1.on
## 
## REML criterion at convergence: 109.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.1262 -0.5291  0.0013  0.4067  4.9347 
## 
## Random effects:
##  Groups   Name        Variance  Std.Dev. 
##  sub      (Intercept) 1.575e-20 1.255e-10
##  Residual             1.134e-01 3.367e-01
## Number of obs: 145, groups:  sub, 29
## 
## Fixed effects:
##                         Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)              0.99658    0.06252 140.00000  15.939   <2e-16 ***
## conditioncontrol        -0.11855    0.08842 140.00000  -1.341    0.182    
## conditionmeaningfully    0.01283    0.08842 140.00000   0.145    0.885    
## conditionmeaninglessly  -0.02061    0.08842 140.00000  -0.233    0.816    
## conditionrepeat          0.12719    0.08842 140.00000   1.439    0.153    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.707                             
## cndtnmnngfl -0.707  0.500                      
## cndtnmnngls -0.707  0.500  0.500               
## conditinrpt -0.707  0.500  0.500      0.500    
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 0.89381 0.22345     4   140  1.9711 0.1022
## # A tibble: 10 × 10
##    .y.   group1      group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr> <chr>       <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 PVRC  answer      contr…    29    29     1.26     28 0.218 1     ns          
##  2 PVRC  answer      meani…    29    29    -0.190    28 0.851 1     ns          
##  3 PVRC  answer      meani…    29    29     0.249    28 0.806 1     ns          
##  4 PVRC  answer      repeat    29    29    -1.46     28 0.155 1     ns          
##  5 PVRC  control     meani…    29    29    -1.25     28 0.221 1     ns          
##  6 PVRC  control     meani…    29    29    -1.14     28 0.265 1     ns          
##  7 PVRC  control     repeat    29    29    -2.29     28 0.03  0.297 ns          
##  8 PVRC  meaningful… meani…    29    29     0.434    28 0.668 1     ns          
##  9 PVRC  meaningful… repeat    29    29    -1.32     28 0.196 1     ns          
## 10 PVRC  meaningles… repeat    29    29    -1.67     28 0.106 1     ns

3.5 Heterogeneity

Packages for calculating Heterogeneity

if(!require(here)) install.packages("here")
## Loading required package: here
## here() starts at /Users/betty/Desktop
library(here)

if(!require(ggplot2)) install.packages("ggplot2")
## Loading required package: ggplot2
library(ggplot2)

if(!require(dplyr)) install.packages("dplyr")
library(dplyr)

if(!require(tidyr)) install.packages("tidyr")
## Loading required package: tidyr
## 
## Attaching package: 'tidyr'
## The following object is masked from 'package:reshape2':
## 
##     smiths
## The following object is masked from 'package:magrittr':
## 
##     extract
## The following objects are masked from 'package:Matrix':
## 
##     expand, pack, unpack
library(tidyr)

if(!require(viridis)) install.packages("viridis")
## Loading required package: viridis
## Loading required package: viridisLite
library(viridis)

if(!require(gridExtra)) install.packages("gridExtra")
## Loading required package: gridExtra
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
library(gridExtra)

if(!require(readr)) install.packages("readr")
## Loading required package: readr
library(readr)

if(!require(plyr)) install.packages("plyr")
## Loading required package: plyr
## ------------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## ------------------------------------------------------------------------------
## 
## Attaching package: 'plyr'
## The following object is masked from 'package:here':
## 
##     here
## The following objects are masked from 'package:dplyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following objects are masked from 'package:rstatix':
## 
##     desc, mutate
library(plyr)

if(!require(stringr)) install.packages("stringr")
## Loading required package: stringr
library(stringr)

if(!require(readxl)) install.packages("readxl")
library(readxl)

if(!require(data.table)) install.packages("data.table")
## Loading required package: data.table
## 
## Attaching package: 'data.table'
## The following objects are masked from 'package:reshape2':
## 
##     dcast, melt
## The following objects are masked from 'package:dplyr':
## 
##     between, first, last
library(data.table)

if(!require(lmerTest)) install.packages("lmerTest")
library(lmerTest)

if(!require(plotly)) install.packages("plotly")
## Loading required package: plotly
## 
## Attaching package: 'plotly'
## The following objects are masked from 'package:plyr':
## 
##     arrange, mutate, rename, summarise
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(plotly)

if(!require(zoo)) install.packages("zoo")
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:data.table':
## 
##     yearmon, yearqtr
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(zoo)

if(!require(viridis)) install.packages("viridis")
library(viridis)

if(!require(brms)) install.packages("brms")
## Loading required package: brms
## Loading required package: Rcpp
## Loading 'brms' package (version 2.22.0). Useful instructions
## can be found by typing help('brms'). A more detailed introduction
## to the package is available through vignette('brms_overview').
## 
## Attaching package: 'brms'
## The following object is masked from 'package:lme4':
## 
##     ngrps
## The following object is masked from 'package:stats':
## 
##     ar
library(brms)

if(!require(purrr)) install.packages("purrr")
## Loading required package: purrr
## 
## Attaching package: 'purrr'
## The following object is masked from 'package:data.table':
## 
##     transpose
## The following object is masked from 'package:plyr':
## 
##     compact
## The following object is masked from 'package:car':
## 
##     some
## The following object is masked from 'package:magrittr':
## 
##     set_names
library(purrr)

if(!require(MASS)) install.packages("MASS")
## Loading required package: MASS
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:plotly':
## 
##     select
## The following object is masked from 'package:dplyr':
## 
##     select
## The following object is masked from 'package:rstatix':
## 
##     select
library(MASS)

if(!require(rstan)) install.packages("rstan")
## Loading required package: rstan
## Loading required package: StanHeaders
## 
## rstan version 2.32.6 (Stan version 2.32.2)
## For execution on a local, multicore CPU with excess RAM we recommend calling
## options(mc.cores = parallel::detectCores()).
## To avoid recompilation of unchanged Stan programs, we recommend calling
## rstan_options(auto_write = TRUE)
## For within-chain threading using `reduce_sum()` or `map_rect()` Stan functions,
## change `threads_per_chain` option:
## rstan_options(threads_per_chain = 1)
## 
## Attaching package: 'rstan'
## The following object is masked from 'package:tidyr':
## 
##     extract
## The following object is masked from 'package:magrittr':
## 
##     extract
library(rstan)

if(!require(ggdist)) install.packages("ggdist")
## Loading required package: ggdist
## 
## Attaching package: 'ggdist'
## The following objects are masked from 'package:brms':
## 
##     dstudent_t, pstudent_t, qstudent_t, rstudent_t
library(ggdist)

if(!require(bayestestR)) install.packages("bayestestR")
## Loading required package: bayestestR
## 
## Attaching package: 'bayestestR'
## The following object is masked from 'package:ggdist':
## 
##     hdi
library(bayestestR)

if(!require(posterior)) install.packages("posterior")
## Loading required package: posterior
## This is posterior version 1.6.0
## 
## Attaching package: 'posterior'
## The following objects are masked from 'package:rstan':
## 
##     ess_bulk, ess_tail
## The following objects are masked from 'package:stats':
## 
##     mad, sd, var
## The following objects are masked from 'package:base':
## 
##     %in%, match
library(posterior)

if(!require(distributional)) install.packages("distributional")
## Loading required package: distributional
library(distributional)

if(!require(cowplot)) install.packages("cowplot")
## Loading required package: cowplot
library(cowplot)

if(!require(modelr)) install.packages("modelr")
## Loading required package: modelr
library(modelr)

if(!require(purrr)) install.packages("purrr")
library(purrr)

if(!require(forcats)) install.packages("forcats")
## Loading required package: forcats
library(forcats)

if(!require(tidybayes)) install.packages("tidybayes")
## Loading required package: tidybayes
## 
## Attaching package: 'tidybayes'
## The following object is masked from 'package:distributional':
## 
##     parameters
## The following object is masked from 'package:bayestestR':
## 
##     hdi
## The following objects are masked from 'package:brms':
## 
##     dstudent_t, pstudent_t, qstudent_t, rstudent_t
library(tidybayes)

if(!require(bayesplot)) install.packages("bayesplot")
## Loading required package: bayesplot
## This is bayesplot version 1.11.1
## - Online documentation and vignettes at mc-stan.org/bayesplot
## - bayesplot theme set to bayesplot::theme_default()
##    * Does _not_ affect other ggplot2 plots
##    * See ?bayesplot_theme_set for details on theme setting
## 
## Attaching package: 'bayesplot'
## The following object is masked from 'package:posterior':
## 
##     rhat
## The following object is masked from 'package:brms':
## 
##     rhat
library(bayesplot)

if(!require(BayesFactor)) install.packages("BayesFactor")
## Loading required package: BayesFactor
## Loading required package: coda
## 
## Attaching package: 'coda'
## The following object is masked from 'package:rstan':
## 
##     traceplot
## ************
## Welcome to BayesFactor 0.9.12-4.7. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).
## 
## Type BFManual() to open the manual.
## ************
library(BayesFactor)

if(!require(patchwork)) install.packages("patchwork")
## Loading required package: patchwork
## 
## Attaching package: 'patchwork'
## The following object is masked from 'package:cowplot':
## 
##     align_plots
## The following object is masked from 'package:MASS':
## 
##     area
library(patchwork)

if(!require(scales)) install.packages("scales")
## Loading required package: scales
## 
## Attaching package: 'scales'
## The following object is masked from 'package:purrr':
## 
##     discard
## The following object is masked from 'package:readr':
## 
##     col_factor
## The following object is masked from 'package:viridis':
## 
##     viridis_pal
library(scales)

SDLP

# scale the data
SDLPdata$age.c <- scale(SDLPdata$age, center = T, scale = F)

# fit model
Model <- lmer(data = SDLPdata, SDLP~beforeafter*condition*age.c+(1+beforeafter|sub))
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDLP ~ beforeafter * condition * age.c + (1 + beforeafter | sub)
##    Data: SDLPdata
## 
## REML criterion at convergence: 294
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0678 -0.4927 -0.0083  0.5983  2.7487 
## 
## Random effects:
##  Groups   Name          Variance Std.Dev. Corr 
##  sub      (Intercept)   0.07328  0.27071       
##           beforeafteron 0.00361  0.06008  -1.00
##  Residual               0.09357  0.30589       
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                              Estimate Std. Error         df
## (Intercept)                                 -0.071573   0.075852  82.622088
## beforeafteron                               -0.177340   0.081101 235.165557
## conditioncontrol                            -0.123441   0.080330 242.999694
## conditionmeaningfully                       -0.040493   0.080330 243.002196
## conditionmeaninglessly                      -0.045602   0.080330 242.999694
## conditionrepeat                              0.114622   0.080330 242.999694
## age.c                                       -0.002878   0.007417  82.684992
## beforeafteron:conditioncontrol               0.346896   0.113604 242.999694
## beforeafteron:conditionmeaningfully          0.253119   0.113604 242.999756
## beforeafteron:conditionmeaninglessly         0.332040   0.113604 242.999694
## beforeafteron:conditionrepeat               -0.131589   0.113604 242.999694
## beforeafteron:age.c                          0.011129   0.007931 235.171190
## conditioncontrol:age.c                       0.004205   0.007855 242.999694
## conditionmeaningfully:age.c                  0.001761   0.007851 243.001331
## conditionmeaninglessly:age.c                 0.009461   0.007855 242.999694
## conditionrepeat:age.c                        0.002628   0.007855 242.999694
## beforeafteron:conditioncontrol:age.c        -0.003036   0.011109 242.999694
## beforeafteron:conditionmeaningfully:age.c   -0.013130   0.011103 242.999735
## beforeafteron:conditionmeaninglessly:age.c  -0.016123   0.011109 242.999694
## beforeafteron:conditionrepeat:age.c         -0.008029   0.011109 242.999694
##                                            t value Pr(>|t|)   
## (Intercept)                                 -0.944  0.34813   
## beforeafteron                               -2.187  0.02975 * 
## conditioncontrol                            -1.537  0.12567   
## conditionmeaningfully                       -0.504  0.61466   
## conditionmeaninglessly                      -0.568  0.57077   
## conditionrepeat                              1.427  0.15490   
## age.c                                       -0.388  0.69902   
## beforeafteron:conditioncontrol               3.054  0.00251 **
## beforeafteron:conditionmeaningfully          2.228  0.02679 * 
## beforeafteron:conditionmeaninglessly         2.923  0.00380 **
## beforeafteron:conditionrepeat               -1.158  0.24787   
## beforeafteron:age.c                          1.403  0.16184   
## conditioncontrol:age.c                       0.535  0.59295   
## conditionmeaningfully:age.c                  0.224  0.82269   
## conditionmeaninglessly:age.c                 1.204  0.22958   
## conditionrepeat:age.c                        0.335  0.73828   
## beforeafteron:conditioncontrol:age.c        -0.273  0.78487   
## beforeafteron:conditionmeaningfully:age.c   -1.183  0.23813   
## beforeafteron:conditionmeaninglessly:age.c  -1.451  0.14797   
## beforeafteron:conditionrepeat:age.c         -0.723  0.47051   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# calculate the contribution of age 
# Get interaction coefficient between age and beforeafter
bXa.coeff <- fixef(Model)[12] 

# Random effect in model for beforeafter - squared to compute variance 
residvalvar <- 0.00361

# Calculate the implied total random effect variance - interaction squared multiplied by variance in age + residual variance.
imptotalvalvar <- bXa.coeff^2*sd(SDLPdata$age.c)^2 + residvalvar

# Variance in mu difference explained by age
V_SDLP <-1- (residvalvar/imptotalvalvar)
V_SDLP
## beforeafteron:age.c 
##           0.7827057
# plot the data
## computing random effects 
ageranef_original <- as.data.frame(ranef(Model)) %>% 
  dplyr::select("grp","term","condval")

library(reshape2)
ageranef <- dcast(ageranef_original, 
                  grp~term, 
                  timevar = c("condval")) 
## Warning in dcast(ageranef_original, grp ~ term, timevar = c("condval")): The
## dcast generic in data.table has been passed a data.frame and will attempt to
## redirect to the relevant reshape2 method; please note that reshape2 is
## superseded and is no longer actively developed, and this redirection is now
## deprecated. Please do this redirection yourself like
## reshape2::dcast(ageranef_original). In the next version, this warning will
## become an error.
## Using 'condval' as value column. Use 'value.var' to override
ageranef <- ageranef %>% rename("intercept_age"="(Intercept)","slope_age"="beforeafteron","sub"="grp")


## Create dataset with one line per person with mileage score 
ageranef <- merge(ageranef, SDLPdata, by = 'sub')
ageranef <- ageranef %>%
  dplyr::group_by(sub) %>%
  dplyr::slice(1) %>%
  dplyr::select(sub, age.c, intercept_age, slope_age)

## Person-specific implied total n-back effects for model accounting for age
ranef.age.pred.tot <- fixef(Model)[2] + # fixed effect for n-back
  fixef(Model)[12] * ageranef$age.c +   # fixed effect for n-back X age interaction # scale of age 
  ageranef$slope_age # estimate random effect of slopes

## relationship between the effect of N-back and age
age.nback.effect.sge_SDLP <- ggplot(ageranef, aes(age.c, ranef.age.pred.tot)) + 
  geom_vline(xintercept = 0, size = .5, color = "black", linetype="solid") +
  geom_hline(yintercept = mean(ranef.age.pred.tot), size = .5, color = "black", linetype="solid") +
  geom_jitter(height = 0, width = 0, size = 4,
              shape = 21, colour = "black", fill = viridis(5)[3], alpha = .95, stroke = 1) + 
  stat_smooth(method = 'lm', ci = T, color = viridis(5)[3], size = 1) + 
  xlab("Age (mean centered)") +
  ylab(expression("Implied total heterogeneity of "~ SDLP)) +
  #ylim(-.15, .1) +
  theme_bw() +
  theme(legend.position = "bottom", legend.direction = "horizontal", axis.title.x = element_text(size = 11), axis.text.x = element_text(size = 15), axis.title.y = element_text(size = 11), axis.text.y = element_text(size = 15), title = element_text(size = 18), legend.title = element_text(size = 12), legend.text = element_text(size = 12), legend.key = element_blank(), legend.key.width = unit(0.3, 'cm'), legend.key.size = unit(0.1, 'cm'), plot.title = element_text(size = 7.5, face = "bold"), strip.text = element_text(face = "bold", size = 10))
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning in stat_smooth(method = "lm", ci = T, color = viridis(5)[3], size = 1):
## Ignoring unknown parameters: `ci`
age.nback.effect.sge_SDLP
## `geom_smooth()` using formula = 'y ~ x'

SDVHA

# scale the data
SDVHdata$age.c <- scale(SDVHdata$age, center = T, scale = F)

# fit model
Model <- lmer(data = SDVHdata, SDVH~beforeafter*condition*age.c+(1+beforeafter|sub))
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDVH ~ beforeafter * condition * age.c + (1 + beforeafter | sub)
##    Data: SDVHdata
## 
## REML criterion at convergence: 424
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -7.7957 -0.4702  0.0008  0.5295  2.0262 
## 
## Random effects:
##  Groups   Name          Variance  Std.Dev. Corr
##  sub      (Intercept)   0.1126592 0.33565      
##           beforeafteron 0.0003094 0.01759  1.00
##  Residual               0.1482212 0.38500      
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                              Estimate Std. Error         df
## (Intercept)                                -4.073e-01  9.485e-02  8.359e+01
## beforeafteron                              -2.748e-01  1.012e-01  2.425e+02
## conditioncontrol                           -1.471e-01  1.011e-01  2.430e+02
## conditionmeaningfully                      -1.058e-01  1.011e-01  2.430e+02
## conditionmeaninglessly                     -1.130e-01  1.011e-01  2.430e+02
## conditionrepeat                             1.097e-01  1.011e-01  2.430e+02
## age.c                                       3.113e-04  9.274e-03  8.366e+01
## beforeafteron:conditioncontrol              4.253e-01  1.430e-01  2.430e+02
## beforeafteron:conditionmeaningfully         2.809e-01  1.430e-01  2.430e+02
## beforeafteron:conditionmeaninglessly        4.853e-01  1.430e-01  2.430e+02
## beforeafteron:conditionrepeat              -1.937e-01  1.430e-01  2.430e+02
## beforeafteron:age.c                         1.209e-02  9.892e-03  2.426e+02
## conditioncontrol:age.c                      7.923e-03  9.887e-03  2.430e+02
## conditionmeaningfully:age.c                -5.967e-03  9.881e-03  2.430e+02
## conditionmeaninglessly:age.c                5.817e-03  9.887e-03  2.430e+02
## conditionrepeat:age.c                      -3.506e-03  9.887e-03  2.430e+02
## beforeafteron:conditioncontrol:age.c       -7.788e-03  1.398e-02  2.430e+02
## beforeafteron:conditionmeaningfully:age.c  -7.995e-03  1.397e-02  2.430e+02
## beforeafteron:conditionmeaninglessly:age.c -1.822e-02  1.398e-02  2.430e+02
## beforeafteron:conditionrepeat:age.c        -3.953e-04  1.398e-02  2.430e+02
##                                            t value Pr(>|t|)    
## (Intercept)                                 -4.295 4.69e-05 ***
## beforeafteron                               -2.716 0.007081 ** 
## conditioncontrol                            -1.455 0.147034    
## conditionmeaningfully                       -1.046 0.296427    
## conditionmeaninglessly                      -1.118 0.264803    
## conditionrepeat                              1.085 0.279175    
## age.c                                        0.034 0.973306    
## beforeafteron:conditioncontrol               2.975 0.003228 ** 
## beforeafteron:conditionmeaningfully          1.965 0.050610 .  
## beforeafteron:conditionmeaninglessly         3.394 0.000803 ***
## beforeafteron:conditionrepeat               -1.354 0.176859    
## beforeafteron:age.c                          1.222 0.222905    
## conditioncontrol:age.c                       0.801 0.423726    
## conditionmeaningfully:age.c                 -0.604 0.546510    
## conditionmeaninglessly:age.c                 0.588 0.556810    
## conditionrepeat:age.c                       -0.355 0.723202    
## beforeafteron:conditioncontrol:age.c        -0.557 0.578050    
## beforeafteron:conditionmeaningfully:age.c   -0.572 0.567761    
## beforeafteron:conditionmeaninglessly:age.c  -1.303 0.193692    
## beforeafteron:conditionrepeat:age.c         -0.028 0.977468    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# calculate the contribution of age 
# Get interaction coefficient between age and beforeafter
bXa.coeff <- fixef(Model)[12] 

# Random effect in model for beforeafter - squared to compute variance 
residvalvar <- 0.0003094

# Calculate the implied total random effect variance - interaction squared multiplied by variance in age + residual variance.
imptotalvalvar <- bXa.coeff^2*sd(SDVHdata$age.c)^2 + residvalvar

# Variance in mu difference explained by age
V_SDVH <- 1 - (residvalvar/imptotalvalvar)
V_SDVH
## beforeafteron:age.c 
##           0.9802287
# plot the data
## computing random effects 
ageranef_original <- as.data.frame(ranef(Model)) %>% 
  dplyr::select("grp","term","condval")

library(reshape2)
ageranef <- dcast(ageranef_original, 
                  grp~term, 
                  timevar = c("condval")) 
## Warning in dcast(ageranef_original, grp ~ term, timevar = c("condval")): The
## dcast generic in data.table has been passed a data.frame and will attempt to
## redirect to the relevant reshape2 method; please note that reshape2 is
## superseded and is no longer actively developed, and this redirection is now
## deprecated. Please do this redirection yourself like
## reshape2::dcast(ageranef_original). In the next version, this warning will
## become an error.
## Using 'condval' as value column. Use 'value.var' to override
ageranef <- ageranef %>% rename("intercept_age"="(Intercept)","slope_age"="beforeafteron","sub"="grp")


#Create dataset with one line per person with mileage score 
ageranef <- merge(ageranef, SDVHdata, by = 'sub')
ageranef <- ageranef %>%
  dplyr::group_by(sub) %>%
  dplyr::slice(1) %>%
  dplyr::select(sub, age.c, intercept_age, slope_age)



# Person-specific implied total n-back effects for model accounting for age
ranef.age.pred.tot <- fixef(Model)[2] + # fixed effect for n-back
  fixef(Model)[12] * ageranef$age.c +   # fixed effect for n-back X age interaction # scale of age 
  ageranef$slope_age # estimate random effect of slopes



# relationship between the effect of N-back and age
age.nback.effect.sge_SDVH <- ggplot(ageranef, aes(age.c, ranef.age.pred.tot)) + 
  geom_vline(xintercept = 0, size = .5, color = "black", linetype="solid") +
  geom_hline(yintercept = mean(ranef.age.pred.tot), size = .5, color = "black", linetype="solid") +
  geom_jitter(height = 0, width = 0, size = 4,
              shape = 21, colour = "black", fill = viridis(5)[3], alpha = .95, stroke = 1) + 
  stat_smooth(method = 'lm', ci = T, color = viridis(5)[3], size = 1) + 
  xlab("Age (mean centered)") +
  ylab(expression("Implied total heterogeneity of "~ SDVH)) +
  #ylim(-.15, .1) +
  theme_bw() +
  theme(legend.position = "bottom", legend.direction = "horizontal", axis.title.x = element_text(size = 11), axis.text.x = element_text(size = 15), axis.title.y = element_text(size = 11), axis.text.y = element_text(size = 15), title = element_text(size = 18), legend.title = element_text(size = 12), legend.text = element_text(size = 12), legend.key = element_blank(), legend.key.width = unit(0.3, 'cm'), legend.key.size = unit(0.1, 'cm'), plot.title = element_text(size = 7.5, face = "bold"), strip.text = element_text(face = "bold", size = 10))
## Warning in stat_smooth(method = "lm", ci = T, color = viridis(5)[3], size = 1):
## Ignoring unknown parameters: `ci`
age.nback.effect.sge_SDVH
## `geom_smooth()` using formula = 'y ~ x'

SDspeed

# scale the data
SDSpeeddata$age.c <- scale(SDSpeeddata$age, center = T, scale = F)

# fit model
Model <- lmer(data = SDSpeeddata, SDSpeed~beforeafter*condition*age.c+(1+beforeafter|sub))
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDSpeed ~ beforeafter * condition * age.c + (1 + beforeafter |  
##     sub)
##    Data: SDSpeeddata
## 
## REML criterion at convergence: 817.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.5896 -0.4541  0.0747  0.5979  1.9285 
## 
## Random effects:
##  Groups   Name          Variance Std.Dev. Corr 
##  sub      (Intercept)   0.24628  0.4963        
##           beforeafteron 0.02416  0.1554   -1.00
##  Residual               0.69695  0.8348        
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                              Estimate Std. Error         df
## (Intercept)                                  0.628037   0.180348 130.276714
## beforeafteron                                0.753303   0.221131 235.454737
## conditioncontrol                             0.163893   0.219239 242.999730
## conditionmeaningfully                        0.166273   0.219240 243.001079
## conditionmeaninglessly                       0.490918   0.219239 242.999730
## conditionrepeat                              0.137747   0.219239 242.999730
## age.c                                        0.005288   0.017636 130.312298
## beforeafteron:conditioncontrol              -0.516859   0.310051 242.999730
## beforeafteron:conditionmeaningfully         -0.075008   0.310052 242.999796
## beforeafteron:conditionmeaninglessly        -0.514545   0.310051 242.999730
## beforeafteron:conditionrepeat               -0.060109   0.310051 242.999730
## beforeafteron:age.c                         -0.001357   0.021624 235.457148
## conditioncontrol:age.c                       0.049582   0.021439 242.999730
## conditionmeaningfully:age.c                 -0.023625   0.021427 243.002807
## conditionmeaninglessly:age.c                -0.001845   0.021439 242.999730
## conditionrepeat:age.c                       -0.013558   0.021439 242.999730
## beforeafteron:conditioncontrol:age.c        -0.017962   0.030319 242.999730
## beforeafteron:conditionmeaningfully:age.c    0.017549   0.030302 242.999881
## beforeafteron:conditionmeaninglessly:age.c  -0.011106   0.030319 242.999730
## beforeafteron:conditionrepeat:age.c         -0.001470   0.030319 242.999730
##                                            t value Pr(>|t|)    
## (Intercept)                                  3.482 0.000677 ***
## beforeafteron                                3.407 0.000773 ***
## conditioncontrol                             0.748 0.455453    
## conditionmeaningfully                        0.758 0.448942    
## conditionmeaninglessly                       2.239 0.026049 *  
## conditionrepeat                              0.628 0.530400    
## age.c                                        0.300 0.764770    
## beforeafteron:conditioncontrol              -1.667 0.096800 .  
## beforeafteron:conditionmeaningfully         -0.242 0.809044    
## beforeafteron:conditionmeaninglessly        -1.660 0.098295 .  
## beforeafteron:conditionrepeat               -0.194 0.846441    
## beforeafteron:age.c                         -0.063 0.950026    
## conditioncontrol:age.c                       2.313 0.021576 *  
## conditionmeaningfully:age.c                 -1.103 0.271314    
## conditionmeaninglessly:age.c                -0.086 0.931500    
## conditionrepeat:age.c                       -0.632 0.527713    
## beforeafteron:conditioncontrol:age.c        -0.592 0.554121    
## beforeafteron:conditionmeaningfully:age.c    0.579 0.563040    
## beforeafteron:conditionmeaninglessly:age.c  -0.366 0.714454    
## beforeafteron:conditionrepeat:age.c         -0.048 0.961383    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# calculate the contribution of age 
# Get interaction coefficient between age and beforeafter
bXa.coeff <- fixef(Model)[12] 

# Random effect in model for beforeafter - squared to compute variance 
residvalvar <- 0.02416

# Calculate the implied total random effect variance - interaction squared multiplied by variance in age + residual variance.
imptotalvalvar <- bXa.coeff^2*sd(SDSpeeddata$age.c)^2 + residvalvar


# Variance in mu difference explained by age
V_SD_speed<- 1 - (residvalvar/imptotalvalvar)
V_SD_speed
## beforeafteron:age.c 
##         0.007934721
# plot the data
## computing random effects 
ageranef_original <- as.data.frame(ranef(Model)) %>% 
  dplyr::select("grp","term","condval")

library(reshape2)
ageranef <- dcast(ageranef_original, 
                  grp~term, 
                  timevar = c("condval")) 
## Warning in dcast(ageranef_original, grp ~ term, timevar = c("condval")): The
## dcast generic in data.table has been passed a data.frame and will attempt to
## redirect to the relevant reshape2 method; please note that reshape2 is
## superseded and is no longer actively developed, and this redirection is now
## deprecated. Please do this redirection yourself like
## reshape2::dcast(ageranef_original). In the next version, this warning will
## become an error.
## Using 'condval' as value column. Use 'value.var' to override
ageranef <- ageranef %>% rename("intercept_age"="(Intercept)","slope_age"="beforeafteron","sub"="grp")


## Create dataset with one line per person with mileage score 
ageranef <- merge(ageranef, SDSpeeddata, by = 'sub')
ageranef <- ageranef %>%
  dplyr::group_by(sub) %>%
  dplyr::slice(1) %>%
  dplyr::select(sub, age.c, intercept_age, slope_age)

## Person-specific implied total n-back effects for model accounting for age
ranef.age.pred.tot <- fixef(Model)[2] + # fixed effect for n-back
  fixef(Model)[12] * ageranef$age.c +   # fixed effect for n-back X age interaction # scale of age 
  ageranef$slope_age # estimate random effect of slopes

## relationship between the effect of N-back and age
age.nback.effect.sge_SDSpeed <- ggplot(ageranef, aes(age.c, ranef.age.pred.tot)) + 
  geom_vline(xintercept = 0, size = .5, color = "black", linetype="solid") +
  geom_hline(yintercept = mean(ranef.age.pred.tot), size = .5, color = "black", linetype="solid") +
  geom_jitter(height = 0, width = 0, size = 4,
              shape = 21, colour = "black", fill = viridis(5)[3], alpha = .95, stroke = 1) + 
  stat_smooth(method = 'lm', ci = T, color = viridis(5)[3], size = 1) + 
  xlab("Age (mean centered)") +
  ylab(expression("Implied total heterogeneity of "~ SD-speed)) +
  #ylim(-.15, .1) +
  theme_bw() +
  theme(legend.position = "bottom", legend.direction = "horizontal", axis.title.x = element_text(size = 11), axis.text.x = element_text(size = 15), axis.title.y = element_text(size = 11), axis.text.y = element_text(size = 15), title = element_text(size = 18), legend.title = element_text(size = 12), legend.text = element_text(size = 12), legend.key = element_blank(), legend.key.width = unit(0.3, 'cm'), legend.key.size = unit(0.1, 'cm'), plot.title = element_text(size = 7.5, face = "bold"), strip.text = element_text(face = "bold", size = 10))
## Warning in stat_smooth(method = "lm", ci = T, color = viridis(5)[3], size = 1):
## Ignoring unknown parameters: `ci`
age.nback.effect.sge_SDSpeed
## `geom_smooth()` using formula = 'y ~ x'

SCL

# scale the data
SCLdata$age.c <- scale(SCLdata$age, center = T, scale = F)

# fit model
Model <- lmer(data = SCLdata, SCL~beforeafter*condition+(1+beforeafter|sub))
## boundary (singular) fit: see help('isSingular')
## Warning: Model failed to converge with 1 negative eigenvalue: -9.8e+01
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SCL ~ beforeafter * condition + (1 + beforeafter | sub)
##    Data: SCLdata
## 
## REML criterion at convergence: 553.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.2647 -0.5144 -0.1277  0.2994  5.1168 
## 
## Random effects:
##  Groups   Name          Variance Std.Dev. Corr
##  sub      (Intercept)   0.00000  0.0000       
##           beforeafteron 0.05386  0.2321    NaN
##  Residual               0.35476  0.5956       
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                       Estimate Std. Error        df t value
## (Intercept)                            1.16091    0.11060 248.07117  10.496
## beforeafteron                          0.82918    0.16225 255.04038   5.111
## conditioncontrol                      -0.06518    0.15642 248.07117  -0.417
## conditionmeaningfully                  0.10921    0.15642 248.07117   0.698
## conditionmeaninglessly                -0.13121    0.15642 248.07117  -0.839
## conditionrepeat                       -0.07328    0.15642 248.07117  -0.468
## beforeafteron:conditioncontrol        -0.90331    0.22121 248.07117  -4.084
## beforeafteron:conditionmeaningfully   -0.45642    0.22121 248.07117  -2.063
## beforeafteron:conditionmeaninglessly  -0.71217    0.22121 248.07117  -3.219
## beforeafteron:conditionrepeat         -0.11845    0.22121 248.07117  -0.535
##                                      Pr(>|t|)    
## (Intercept)                           < 2e-16 ***
## beforeafteron                        6.30e-07 ***
## conditioncontrol                      0.67727    
## conditionmeaningfully                 0.48573    
## conditionmeaninglessly                0.40237    
## conditionrepeat                       0.63987    
## beforeafteron:conditioncontrol       5.99e-05 ***
## beforeafteron:conditionmeaningfully   0.04012 *  
## beforeafteron:conditionmeaninglessly  0.00146 ** 
## beforeafteron:conditionrepeat         0.59282    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##                    (Intr) bfrftr cndtnc cndtnmnngf cndtnmnngl cndtnr
## beforeaftrn        -0.682                                           
## condtncntrl        -0.707  0.482                                    
## cndtnmnngfl        -0.707  0.482  0.500                             
## cndtnmnngls        -0.707  0.482  0.500  0.500                      
## conditinrpt        -0.707  0.482  0.500  0.500      0.500           
## bfrftrn:cndtnc      0.500 -0.682 -0.707 -0.354     -0.354     -0.354
## bfrftrn:cndtnmnngf  0.500 -0.682 -0.354 -0.707     -0.354     -0.354
## bfrftrn:cndtnmnngl  0.500 -0.682 -0.354 -0.354     -0.707     -0.354
## bfrftrn:cndtnr      0.500 -0.682 -0.354 -0.354     -0.354     -0.707
##                    bfrftrn:cndtnc bfrftrn:cndtnmnngf bfrftrn:cndtnmnngl
## beforeaftrn                                                            
## condtncntrl                                                            
## cndtnmnngfl                                                            
## cndtnmnngls                                                            
## conditinrpt                                                            
## bfrftrn:cndtnc                                                         
## bfrftrn:cndtnmnngf  0.500                                              
## bfrftrn:cndtnmnngl  0.500          0.500                               
## bfrftrn:cndtnr      0.500          0.500              0.500            
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# calculate the contribution of age 
# Get interaction coefficient between age and beforeafter
bXa.coeff <- fixef(Model)[12] # the estimate parameter of age.c and beforeafter interaction effect

#Random effect in model for beforeafter - squared to compute variance 
residvalvar <- 0.05661

#Calculate the implied total random effect variance - interaction squared multiplied by variance in age + residual variance.
imptotalvalvar <- bXa.coeff^2*sd(SCLdata$age.c)^2 + residvalvar

## Variance in mu difference explained by age 
V_SCL <- 1 - (residvalvar/imptotalvalvar)
V_SCL
## <NA> 
##   NA
# plot the data
# computing random effects 
ageranef_original <- as.data.frame(ranef(Model)) %>% 
  dplyr::select("grp","term","condval")

library(reshape2)
ageranef <- dcast(ageranef_original, 
                  grp~term, 
                  timevar = c("condval")) 
## Warning in dcast(ageranef_original, grp ~ term, timevar = c("condval")): The
## dcast generic in data.table has been passed a data.frame and will attempt to
## redirect to the relevant reshape2 method; please note that reshape2 is
## superseded and is no longer actively developed, and this redirection is now
## deprecated. Please do this redirection yourself like
## reshape2::dcast(ageranef_original). In the next version, this warning will
## become an error.
## Using 'condval' as value column. Use 'value.var' to override
ageranef <- ageranef %>% rename("intercept_age"="(Intercept)","slope_age"="beforeafteron","sub"="grp")


#Create dataset with one line per person with mileage score 
ageranef <- merge(ageranef, SCLdata, by = 'sub')
ageranef <- ageranef %>%
  dplyr::group_by(sub) %>%
  dplyr::slice(1) %>%
  dplyr::select(sub, age.c, intercept_age, slope_age)


# Person-specific implied total n-back effects for model accounting for age
ranef.age.pred.tot <- fixef(Model)[2] + # fixed effect for n-back
  fixef(Model)[12] * ageranef$age.c +   # fixed effect for n-back X age interaction # scale of age 
  ageranef$slope_age # estimate random effect of slopes


# relationship between the effect of N-back and age
age.nback.effect.sge_SCL <- ggplot(ageranef, aes(age.c, ranef.age.pred.tot)) + 
  geom_vline(xintercept = 0, size = .5, color = "black", linetype="solid") +
  geom_hline(yintercept = mean(ranef.age.pred.tot), size = .5, color = "black", linetype="solid") +
  geom_jitter(height = 0, width = 0, size = 4,
              shape = 21, colour = "black", fill = viridis(5)[3], alpha = .95, stroke = 1) + 
  stat_smooth(method = 'lm', ci = T, color = viridis(5)[3], size = 1) + 
  xlab("Age (mean centered)") +
  ylab(expression("Implied total heterogeneity of "~ SCL)) +
  #ylim(-.15, .1) +
  theme_bw() +
  theme(legend.position = "bottom", legend.direction = "horizontal", axis.title.x = element_text(size = 11), axis.text.x = element_text(size = 15), axis.title.y = element_text(size = 11), axis.text.y = element_text(size = 15), title = element_text(size = 18), legend.title = element_text(size = 12), legend.text = element_text(size = 12), legend.key = element_blank(), legend.key.width = unit(0.3, 'cm'), legend.key.size = unit(0.1, 'cm'), plot.title = element_text(size = 7.5, face = "bold"), strip.text = element_text(face = "bold", size = 10))
## Warning in stat_smooth(method = "lm", ci = T, color = viridis(5)[3], size = 1):
## Ignoring unknown parameters: `ci`
age.nback.effect.sge_SCL
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 29 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_hline()`).
## Warning: Removed 29 rows containing missing values or values outside the scale range
## (`geom_point()`).

SDNN

# scale the data
SDNNdata$age.c <- scale(SDNNdata$age, center = T, scale = F)

# fit model
library(lmerTest)
Model <- lmer(data = SDNNdata, SDNN~beforeafter*condition*age.c+(1+beforeafter|sub))
## boundary (singular) fit: see help('isSingular')
## Warning: Model failed to converge with 1 negative eigenvalue: -2.6e+02
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SDNN ~ beforeafter * condition * age.c + (1 + beforeafter | sub)
##    Data: SDNNdata
## 
## REML criterion at convergence: 321.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.2872 -0.6244 -0.0278  0.5586  2.6948 
## 
## Random effects:
##  Groups   Name          Variance Std.Dev. Corr
##  sub      (Intercept)   0.00000  0.0000       
##           beforeafteron 0.01036  0.1018    NaN
##  Residual               0.12212  0.3495       
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                              Estimate Std. Error         df
## (Intercept)                                -4.755e-02  6.489e-02  2.419e+02
## beforeafteron                               3.365e-01  9.370e-02  2.644e+02
## conditioncontrol                            1.608e-01  9.177e-02  2.419e+02
## conditionmeaningfully                       1.311e-01  9.177e-02  2.419e+02
## conditionmeaninglessly                      2.217e-01  9.177e-02  2.419e+02
## conditionrepeat                             1.981e-02  9.177e-02  2.419e+02
## age.c                                      -1.721e-03  6.346e-03  2.419e+02
## beforeafteron:conditioncontrol             -4.848e-01  1.298e-01  2.419e+02
## beforeafteron:conditionmeaningfully        -2.026e-01  1.298e-01  2.419e+02
## beforeafteron:conditionmeaninglessly       -2.703e-01  1.298e-01  2.419e+02
## beforeafteron:conditionrepeat               1.097e-01  1.298e-01  2.419e+02
## beforeafteron:age.c                         4.602e-03  9.162e-03  2.644e+02
## conditioncontrol:age.c                      1.237e-03  8.974e-03  2.419e+02
## conditionmeaningfully:age.c                -4.862e-03  8.969e-03  2.419e+02
## conditionmeaninglessly:age.c                1.990e-03  8.974e-03  2.419e+02
## conditionrepeat:age.c                       7.110e-03  8.974e-03  2.419e+02
## beforeafteron:conditioncontrol:age.c       -7.075e-04  1.269e-02  2.419e+02
## beforeafteron:conditionmeaningfully:age.c  -4.887e-03  1.268e-02  2.419e+02
## beforeafteron:conditionmeaninglessly:age.c -1.107e-02  1.269e-02  2.419e+02
## beforeafteron:conditionrepeat:age.c        -1.284e-02  1.269e-02  2.419e+02
##                                            t value Pr(>|t|)    
## (Intercept)                                 -0.733 0.464377    
## beforeafteron                                3.592 0.000391 ***
## conditioncontrol                             1.752 0.081039 .  
## conditionmeaningfully                        1.429 0.154425    
## conditionmeaninglessly                       2.415 0.016461 *  
## conditionrepeat                              0.216 0.829285    
## age.c                                       -0.271 0.786408    
## beforeafteron:conditioncontrol              -3.735 0.000234 ***
## beforeafteron:conditionmeaningfully         -1.561 0.119907    
## beforeafteron:conditionmeaninglessly        -2.083 0.038337 *  
## beforeafteron:conditionrepeat                0.845 0.398711    
## beforeafteron:age.c                          0.502 0.615908    
## conditioncontrol:age.c                       0.138 0.890465    
## conditionmeaningfully:age.c                 -0.542 0.588272    
## conditionmeaninglessly:age.c                 0.222 0.824731    
## conditionrepeat:age.c                        0.792 0.428966    
## beforeafteron:conditioncontrol:age.c        -0.056 0.955588    
## beforeafteron:conditionmeaningfully:age.c   -0.385 0.700358    
## beforeafteron:conditionmeaninglessly:age.c  -0.872 0.384070    
## beforeafteron:conditionrepeat:age.c         -1.012 0.312665    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
### calculate the contribution of age 
# Get interaction coefficient between age and beforeafter
bXa.coeff <- fixef(Model)[12]  # the estimate parameter of age.c and beforeafter interaction effect

#Random effect in model for beforeafter - squared to compute variance 
residvalvar <- 0.01036

#Calculate the implied total random effect variance - interaction squared multiplied by variance in age + residual variance.
imptotalvalvar <- bXa.coeff^2*sd(SDNNdata$age.c)^2 + residvalvar


## Variance in mu difference explained by age
V_SDNN <- 1 - (residvalvar/imptotalvalvar)
V_SDNN
## beforeafteron:age.c 
##           0.1766829
# plot the data
## computing random effects 
ageranef_original <- as.data.frame(ranef(Model)) %>% 
  dplyr::select("grp","term","condval")

library(reshape2)
ageranef <- dcast(ageranef_original, 
                  grp~term, 
                  timevar = c("condval")) 
## Warning in dcast(ageranef_original, grp ~ term, timevar = c("condval")): The
## dcast generic in data.table has been passed a data.frame and will attempt to
## redirect to the relevant reshape2 method; please note that reshape2 is
## superseded and is no longer actively developed, and this redirection is now
## deprecated. Please do this redirection yourself like
## reshape2::dcast(ageranef_original). In the next version, this warning will
## become an error.
## Using 'condval' as value column. Use 'value.var' to override
ageranef <- ageranef %>% rename("intercept_age"="(Intercept)","slope_age"="beforeafteron","sub"="grp")


## Create dataset with one line per person with mileage score 
ageranef <- merge(ageranef, SDNNdata, by = 'sub')
ageranef <- ageranef %>%
  dplyr::group_by(sub) %>%
  dplyr::slice(1) %>%
  dplyr::select(sub, age.c, intercept_age, slope_age)


## Person-specific implied total n-back effects for model accounting for age
ranef.age.pred.tot <- fixef(Model)[2] + # fixed effect for n-back
  fixef(Model)[12] * ageranef$age.c +   # fixed effect for n-back X age interaction # scale of age 
  ageranef$slope_age # estimate random effect of slopes


## relationship between the effect of N-back and age
age.nback.effect.sge_SDNN <- ggplot(ageranef, aes(age.c, ranef.age.pred.tot)) + 
  geom_vline(xintercept = 0, size = .5, color = "black", linetype="solid") +
  geom_hline(yintercept = mean(ranef.age.pred.tot), size = .5, color = "black", linetype="solid") +
  geom_jitter(height = 0, width = 0, size = 4,
              shape = 21, colour = "black", fill = viridis(5)[3], alpha = .95, stroke = 1) + 
  stat_smooth(method = 'lm', ci = T, color = viridis(5)[3], size = 1) + 
  xlab("Age (mean centered)") +
  ylab(expression("Implied total heterogeneity of "~ SDNN)) +
  #ylim(-.15, .1) +
  theme_bw() +
  theme(legend.position = "bottom", legend.direction = "horizontal", axis.title.x = element_text(size = 11), axis.text.x = element_text(size = 15), axis.title.y = element_text(size = 11), axis.text.y = element_text(size = 15), title = element_text(size = 18), legend.title = element_text(size = 12), legend.text = element_text(size = 12), legend.key = element_blank(), legend.key.width = unit(0.3, 'cm'), legend.key.size = unit(0.1, 'cm'), plot.title = element_text(size = 7.5, face = "bold"), strip.text = element_text(face = "bold", size = 10))
## Warning in stat_smooth(method = "lm", ci = T, color = viridis(5)[3], size = 1):
## Ignoring unknown parameters: `ci`
age.nback.effect.sge_SDNN
## `geom_smooth()` using formula = 'y ~ x'

Breathing rate

# scale the data
RESPdata$age.c <- scale(RESPdata$age, center = T, scale = F)

# fit model
Model <- lmer(data = RESPdata, RESP~beforeafter*condition*age.c+(1+beforeafter|sub))
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: RESP ~ beforeafter * condition * age.c + (1 + beforeafter | sub)
##    Data: RESPdata
## 
## REML criterion at convergence: 189.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.5569 -0.3752  0.0764  0.5276  3.0629 
## 
## Random effects:
##  Groups   Name          Variance Std.Dev. Corr
##  sub      (Intercept)   0.008145 0.09025      
##           beforeafteron 0.002668 0.05165  1.00
##  Residual               0.069295 0.26324      
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                              Estimate Std. Error         df
## (Intercept)                                -1.208e-01  5.168e-02  1.998e+02
## beforeafteron                               4.558e-02  6.979e-02  2.367e+02
## conditioncontrol                            1.272e-01  6.913e-02  2.430e+02
## conditionmeaningfully                       1.247e-01  6.913e-02  2.430e+02
## conditionmeaninglessly                      1.057e-01  6.913e-02  2.430e+02
## conditionrepeat                             1.597e-01  6.913e-02  2.430e+02
## age.c                                      -8.163e-04  5.053e-03  1.998e+02
## beforeafteron:conditioncontrol             -6.163e-02  9.777e-02  2.430e+02
## beforeafteron:conditionmeaningfully        -1.489e-01  9.777e-02  2.430e+02
## beforeafteron:conditionmeaninglessly       -1.058e-01  9.777e-02  2.430e+02
## beforeafteron:conditionrepeat              -5.216e-02  9.777e-02  2.430e+02
## beforeafteron:age.c                         3.779e-03  6.825e-03  2.367e+02
## conditioncontrol:age.c                      1.945e-04  6.760e-03  2.430e+02
## conditionmeaningfully:age.c                -6.917e-04  6.756e-03  2.430e+02
## conditionmeaninglessly:age.c               -4.107e-03  6.760e-03  2.430e+02
## conditionrepeat:age.c                       2.752e-04  6.760e-03  2.430e+02
## beforeafteron:conditioncontrol:age.c       -4.584e-03  9.560e-03  2.430e+02
## beforeafteron:conditionmeaningfully:age.c   4.232e-03  9.555e-03  2.430e+02
## beforeafteron:conditionmeaninglessly:age.c  1.451e-03  9.560e-03  2.430e+02
## beforeafteron:conditionrepeat:age.c        -5.459e-03  9.560e-03  2.430e+02
##                                            t value Pr(>|t|)  
## (Intercept)                                 -2.337   0.0204 *
## beforeafteron                                0.653   0.5144  
## conditioncontrol                             1.840   0.0670 .
## conditionmeaningfully                        1.804   0.0725 .
## conditionmeaninglessly                       1.529   0.1276  
## conditionrepeat                              2.310   0.0217 *
## age.c                                       -0.162   0.8718  
## beforeafteron:conditioncontrol              -0.630   0.5291  
## beforeafteron:conditionmeaningfully         -1.523   0.1292  
## beforeafteron:conditionmeaninglessly        -1.082   0.2804  
## beforeafteron:conditionrepeat               -0.534   0.5941  
## beforeafteron:age.c                          0.554   0.5803  
## conditioncontrol:age.c                       0.029   0.9771  
## conditionmeaningfully:age.c                 -0.102   0.9185  
## conditionmeaninglessly:age.c                -0.607   0.5441  
## conditionrepeat:age.c                        0.041   0.9676  
## beforeafteron:conditioncontrol:age.c        -0.479   0.6320  
## beforeafteron:conditionmeaningfully:age.c    0.443   0.6583  
## beforeafteron:conditionmeaninglessly:age.c   0.152   0.8795  
## beforeafteron:conditionrepeat:age.c         -0.571   0.5685  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# calculate the contribution of age 
## Get interaction coefficient between age and beforeafter
bXa.coeff <- fixef(Model)[12] 

## Random effect in model for beforeafter - squared to compute variance 
residvalvar <- 0.002668

## Calculate the implied total random effect variance - interaction squared multiplied by variance in age + residual variance.
imptotalvalvar <- bXa.coeff^2*sd(RESPdata$age.c)^2 + residvalvar

## Variance in mu difference explained by age
V_RESP <- 1 - (residvalvar/imptotalvalvar)
V_RESP 
## beforeafteron:age.c 
##           0.3597392
# plot the data
## computing random effects 
ageranef_original <- as.data.frame(ranef(Model)) %>% 
  dplyr::select("grp","term","condval")

library(reshape2)
ageranef <- dcast(ageranef_original, 
                  grp~term, 
                  timevar = c("condval")) 
## Warning in dcast(ageranef_original, grp ~ term, timevar = c("condval")): The
## dcast generic in data.table has been passed a data.frame and will attempt to
## redirect to the relevant reshape2 method; please note that reshape2 is
## superseded and is no longer actively developed, and this redirection is now
## deprecated. Please do this redirection yourself like
## reshape2::dcast(ageranef_original). In the next version, this warning will
## become an error.
## Using 'condval' as value column. Use 'value.var' to override
ageranef <- ageranef %>% rename("intercept_age"="(Intercept)","slope_age"="beforeafteron","sub"="grp")


## Create dataset with one line per person with mileage score 
ageranef <- merge(ageranef, RESPdata, by = 'sub')
ageranef <- ageranef %>%
  dplyr::group_by(sub) %>%
  dplyr::slice(1) %>%
  dplyr::select(sub, age.c, intercept_age, slope_age)

## Person-specific implied total n-back effects for model accounting for age
ranef.age.pred.tot <- fixef(Model)[2] + # fixed effect for n-back
  fixef(Model)[12] * ageranef$age.c +   # fixed effect for n-back X age interaction # scale of age 
  ageranef$slope_age # estimate random effect of slopes

## relationship between the effect of N-back and age
age.nback.effect.sge_breathingrate <- ggplot(ageranef, aes(age.c, ranef.age.pred.tot)) + 
  geom_vline(xintercept = 0, size = .5, color = "black", linetype="solid") +
  geom_hline(yintercept = mean(ranef.age.pred.tot), size = .5, color = "black", linetype="solid") +
  geom_jitter(height = 0, width = 0, size = 4,
              shape = 21, colour = "black", fill = viridis(5)[3], alpha = .95, stroke = 1) + 
  stat_smooth(method = 'lm', ci = T, color = viridis(5)[3], size = 1) + 
  xlab("Age (mean centered)") +
  ylab(expression("Implied total heterogeneity of "~ breathing~rate)) +
  #ylim(-.15, .1) +
  theme_bw() +
  theme(legend.position = "bottom", legend.direction = "horizontal", axis.title.x = element_text(size = 11), axis.text.x = element_text(size = 15), axis.title.y = element_text(size = 11), axis.text.y = element_text(size = 15), title = element_text(size = 18), legend.title = element_text(size = 12), legend.text = element_text(size = 12), legend.key = element_blank(), legend.key.width = unit(0.3, 'cm'), legend.key.size = unit(0.1, 'cm'), plot.title = element_text(size = 7.5, face = "bold"), strip.text = element_text(face = "bold", size = 10))
## Warning in stat_smooth(method = "lm", ci = T, color = viridis(5)[3], size = 1):
## Ignoring unknown parameters: `ci`
age.nback.effect.sge_breathingrate
## `geom_smooth()` using formula = 'y ~ x'

PD

# scale the data
PDdata$age.c <- scale(PDdata$age, center = T, scale = F)

# fit model
Model <- lmer(data = PDdata, PD~beforeafter*condition*age.c+(1+beforeafter|sub))
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: PD ~ beforeafter * condition * age.c + (1 + beforeafter | sub)
##    Data: PDdata
## 
## REML criterion at convergence: -552.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.3610 -0.5808 -0.0081  0.6074  3.2957 
## 
## Random effects:
##  Groups   Name          Variance  Std.Dev. Corr
##  sub      (Intercept)   0.0006927 0.02632      
##           beforeafteron 0.0003204 0.01790  1.00
##  Residual               0.0043103 0.06565      
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                              Estimate Std. Error         df
## (Intercept)                                 9.990e-01  1.313e-02  1.780e+02
## beforeafteron                               1.253e-01  1.756e-02  2.264e+02
## conditioncontrol                            2.310e-03  1.724e-02  2.430e+02
## conditionmeaningfully                      -1.559e-03  1.724e-02  2.430e+02
## conditionmeaninglessly                      1.131e-02  1.724e-02  2.430e+02
## conditionrepeat                            -8.319e-03  1.724e-02  2.430e+02
## age.c                                      -3.163e-04  1.284e-03  1.781e+02
## beforeafteron:conditioncontrol             -1.300e-01  2.438e-02  2.430e+02
## beforeafteron:conditionmeaningfully        -1.137e-01  2.438e-02  2.430e+02
## beforeafteron:conditionmeaninglessly       -1.362e-01  2.438e-02  2.430e+02
## beforeafteron:conditionrepeat              -3.783e-02  2.438e-02  2.430e+02
## beforeafteron:age.c                         1.953e-03  1.717e-03  2.264e+02
## conditioncontrol:age.c                      8.821e-04  1.686e-03  2.430e+02
## conditionmeaningfully:age.c                 9.116e-04  1.685e-03  2.430e+02
## conditionmeaninglessly:age.c                3.650e-04  1.686e-03  2.430e+02
## conditionrepeat:age.c                      -2.636e-04  1.686e-03  2.430e+02
## beforeafteron:conditioncontrol:age.c       -1.161e-03  2.384e-03  2.430e+02
## beforeafteron:conditionmeaningfully:age.c  -2.319e-03  2.383e-03  2.430e+02
## beforeafteron:conditionmeaninglessly:age.c -7.198e-04  2.384e-03  2.430e+02
## beforeafteron:conditionrepeat:age.c        -1.561e-03  2.384e-03  2.430e+02
##                                            t value Pr(>|t|)    
## (Intercept)                                 76.059  < 2e-16 ***
## beforeafteron                                7.137 1.28e-11 ***
## conditioncontrol                             0.134    0.894    
## conditionmeaningfully                       -0.090    0.928    
## conditionmeaninglessly                       0.656    0.512    
## conditionrepeat                             -0.483    0.630    
## age.c                                       -0.246    0.806    
## beforeafteron:conditioncontrol              -5.332 2.22e-07 ***
## beforeafteron:conditionmeaningfully         -4.664 5.12e-06 ***
## beforeafteron:conditionmeaninglessly        -5.588 6.16e-08 ***
## beforeafteron:conditionrepeat               -1.551    0.122    
## beforeafteron:age.c                          1.137    0.257    
## conditioncontrol:age.c                       0.523    0.601    
## conditionmeaningfully:age.c                  0.541    0.589    
## conditionmeaninglessly:age.c                 0.217    0.829    
## conditionrepeat:age.c                       -0.156    0.876    
## beforeafteron:conditioncontrol:age.c        -0.487    0.627    
## beforeafteron:conditionmeaningfully:age.c   -0.973    0.331    
## beforeafteron:conditionmeaninglessly:age.c  -0.302    0.763    
## beforeafteron:conditionrepeat:age.c         -0.655    0.513    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# calculate the contribution of age 
# Get interaction coefficient between age and beforeafter
bXa.coeff <- fixef(Model)[12] 

# Random effect in model for beforeafter - squared to compute variance 
residvalvar <- 0.0003204

# Calculate the implied total random effect variance - interaction squared multiplied by variance in age + residual variance.
imptotalvalvar <- bXa.coeff^2*sd(PDdata$age.c)^2 + residvalvar

# Variance in mu difference explained by age
V_PD <- 1 - (residvalvar/imptotalvalvar)
V_PD
## beforeafteron:age.c 
##           0.5555394
# plot the data
## computing random effects 
ageranef_original <- as.data.frame(ranef(Model)) %>% 
  dplyr::select("grp","term","condval")

library(reshape2)
ageranef <- dcast(ageranef_original, 
                  grp~term, 
                  timevar = c("condval")) 
## Warning in dcast(ageranef_original, grp ~ term, timevar = c("condval")): The
## dcast generic in data.table has been passed a data.frame and will attempt to
## redirect to the relevant reshape2 method; please note that reshape2 is
## superseded and is no longer actively developed, and this redirection is now
## deprecated. Please do this redirection yourself like
## reshape2::dcast(ageranef_original). In the next version, this warning will
## become an error.
## Using 'condval' as value column. Use 'value.var' to override
ageranef <- ageranef %>% rename("intercept_age"="(Intercept)","slope_age"="beforeafteron","sub"="grp")


## Create dataset with one line per person with mileage score 
ageranef <- merge(ageranef, PDdata, by = 'sub')
ageranef <- ageranef %>%
  dplyr::group_by(sub) %>%
  dplyr::slice(1) %>%
  dplyr::select(sub, age.c, intercept_age, slope_age)



## Person-specific implied total n-back effects for model accounting for age
ranef.age.pred.tot <- fixef(Model)[2] + # fixed effect for n-back
  fixef(Model)[12] * ageranef$age.c +   # fixed effect for n-back X age interaction # scale of age 
  ageranef$slope_age # estimate random effect of slopes



## relationship between the effect of N-back and age
age.nback.effect.sge_pupildiameter <- ggplot(ageranef, aes(age.c, ranef.age.pred.tot)) + 
  geom_vline(xintercept = 0, size = .5, color = "black", linetype="solid") +
  geom_hline(yintercept = mean(ranef.age.pred.tot), size = .5, color = "black", linetype="solid") +
  geom_jitter(height = 0, width = 0, size = 4,
              shape = 21, colour = "black", fill = viridis(5)[3], alpha = .95, stroke = 1) + 
  stat_smooth(method = 'lm', ci = T, color = viridis(5)[3], size = 1) + 
  xlab("Age (mean centered)") +
  ylab(expression("Implied total heterogeneity of "~ pupil~diameter)) +
  #ylim(-.15, .1) +
  theme_bw() +
  theme(legend.position = "bottom", legend.direction = "horizontal", axis.title.x = element_text(size = 11), axis.text.x = element_text(size = 15), axis.title.y = element_text(size = 11), axis.text.y = element_text(size = 15), title = element_text(size = 18), legend.title = element_text(size = 12), legend.text = element_text(size = 12), legend.key = element_blank(), legend.key.width = unit(0.3, 'cm'), legend.key.size = unit(0.1, 'cm'), plot.title = element_text(size = 7.5, face = "bold"), strip.text = element_text(face = "bold", size = 10))
## Warning in stat_smooth(method = "lm", ci = T, color = viridis(5)[3], size = 1):
## Ignoring unknown parameters: `ci`
age.nback.effect.sge_pupildiameter
## `geom_smooth()` using formula = 'y ~ x'

### PVRC

# scale the data
PVRCdata$age.c <- scale(PVRCdata$age, center = T, scale = F)

# fit model
Model <- lmer(data = PVRCdata, PVRC~beforeafter*condition*age.c+(1+beforeafter|sub))
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: PVRC ~ beforeafter * condition * age.c + (1 + beforeafter | sub)
##    Data: PVRCdata
## 
## REML criterion at convergence: 278.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.3607 -0.5027 -0.0113  0.4194  4.8110 
## 
## Random effects:
##  Groups   Name          Variance  Std.Dev. Corr 
##  sub      (Intercept)   0.0104590 0.10227       
##           beforeafteron 0.0002471 0.01572  -1.00
##  Residual               0.1010921 0.31795       
## Number of obs: 290, groups:  sub, 29
## 
## Fixed effects:
##                                              Estimate Std. Error         df
## (Intercept)                                 8.433e-01  6.202e-02  2.059e+02
## beforeafteron                               1.533e-01  8.355e-02  2.427e+02
## conditioncontrol                            1.836e-01  8.350e-02  2.430e+02
## conditionmeaningfully                       1.030e-01  8.350e-02  2.430e+02
## conditionmeaninglessly                      6.242e-02  8.350e-02  2.430e+02
## conditionrepeat                             4.500e-02  8.350e-02  2.430e+02
## age.c                                      -4.689e-04  6.065e-03  2.059e+02
## beforeafteron:conditioncontrol             -3.022e-01  1.181e-01  2.430e+02
## beforeafteron:conditionmeaningfully        -9.015e-02  1.181e-01  2.430e+02
## beforeafteron:conditionmeaninglessly       -8.301e-02  1.181e-01  2.430e+02
## beforeafteron:conditionrepeat               8.212e-02  1.181e-01  2.430e+02
## beforeafteron:age.c                         3.387e-03  8.170e-03  2.427e+02
## conditioncontrol:age.c                     -3.443e-03  8.165e-03  2.430e+02
## conditionmeaningfully:age.c                -3.218e-03  8.161e-03  2.430e+02
## conditionmeaninglessly:age.c               -2.004e-04  8.165e-03  2.430e+02
## conditionrepeat:age.c                      -1.424e-03  8.165e-03  2.430e+02
## beforeafteron:conditioncontrol:age.c        4.210e-03  1.155e-02  2.430e+02
## beforeafteron:conditionmeaningfully:age.c  -2.011e-03  1.154e-02  2.430e+02
## beforeafteron:conditionmeaninglessly:age.c  2.221e-03  1.155e-02  2.430e+02
## beforeafteron:conditionrepeat:age.c        -9.363e-03  1.155e-02  2.430e+02
##                                            t value Pr(>|t|)    
## (Intercept)                                 13.597   <2e-16 ***
## beforeafteron                                1.835   0.0677 .  
## conditioncontrol                             2.199   0.0288 *  
## conditionmeaningfully                        1.234   0.2184    
## conditionmeaninglessly                       0.748   0.4554    
## conditionrepeat                              0.539   0.5904    
## age.c                                       -0.077   0.9385    
## beforeafteron:conditioncontrol              -2.559   0.0111 *  
## beforeafteron:conditionmeaningfully         -0.763   0.4459    
## beforeafteron:conditionmeaninglessly        -0.703   0.4827    
## beforeafteron:conditionrepeat                0.695   0.4875    
## beforeafteron:age.c                          0.415   0.6789    
## conditioncontrol:age.c                      -0.422   0.6736    
## conditionmeaningfully:age.c                 -0.394   0.6937    
## conditionmeaninglessly:age.c                -0.025   0.9804    
## conditionrepeat:age.c                       -0.174   0.8617    
## beforeafteron:conditioncontrol:age.c         0.365   0.7157    
## beforeafteron:conditionmeaningfully:age.c   -0.174   0.8618    
## beforeafteron:conditionmeaninglessly:age.c   0.192   0.8476    
## beforeafteron:conditionrepeat:age.c         -0.811   0.4182    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 20 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
# calculate the contribution of age 
# Get interaction coefficient between age and beforeafter
bXa.coeff <- fixef(Model)[12] 

# Random effect in model for beforeafter - squared to compute variance 
residvalvar <- 0.0002471

# Calculate the implied total random effect variance - interaction squared multiplied by variance in age + residual variance.
imptotalvalvar <- bXa.coeff^2*sd(PVRCdata$age.c)^2 + residvalvar

# Variance in mu difference explained by age
V_PVRC <- 1 - (residvalvar/imptotalvalvar)
V_PVRC 
## beforeafteron:age.c 
##           0.8297245
# plot the data
## computing random effects 
ageranef_original <- as.data.frame(ranef(Model)) %>% 
  dplyr::select("grp","term","condval")

library(reshape2)
ageranef <- dcast(ageranef_original, 
                  grp~term, 
                  timevar = c("condval")) 
## Warning in dcast(ageranef_original, grp ~ term, timevar = c("condval")): The
## dcast generic in data.table has been passed a data.frame and will attempt to
## redirect to the relevant reshape2 method; please note that reshape2 is
## superseded and is no longer actively developed, and this redirection is now
## deprecated. Please do this redirection yourself like
## reshape2::dcast(ageranef_original). In the next version, this warning will
## become an error.
## Using 'condval' as value column. Use 'value.var' to override
ageranef <- ageranef %>% rename("intercept_age"="(Intercept)","slope_age"="beforeafteron","sub"="grp")


## Create dataset with one line per person with mileage score 
ageranef <- merge(ageranef, PVRCdata, by = 'sub')
ageranef <- ageranef %>%
  dplyr::group_by(sub) %>%
  dplyr::slice(1) %>%
  dplyr::select(sub, age.c, intercept_age, slope_age)



## Person-specific implied total n-back effects for model accounting for age
ranef.age.pred.tot <- fixef(Model)[2] + # fixed effect for n-back
  fixef(Model)[12] * ageranef$age.c +   # fixed effect for n-back X age interaction # scale of age 
  ageranef$slope_age # estimate random effect of slopes



## relationship between the effect of N-back and age
age.nback.effect.sge_PVRC <- ggplot(ageranef, aes(age.c, ranef.age.pred.tot)) + 
  geom_vline(xintercept = 0, size = .5, color = "black", linetype="solid") +
  geom_hline(yintercept = mean(ranef.age.pred.tot), size = .5, color = "black", linetype="solid") +
  geom_jitter(height = 0, width = 0, size = 4,
              shape = 21, colour = "black", fill = viridis(5)[3], alpha = .95, stroke = 1) + 
  stat_smooth(method = 'lm', ci = T, color = viridis(5)[3], size = 1) + 
  xlab("Age (mean centered)") +
  ylab(expression("Implied total heterogeneity of "~ PVRC)) +
  #ylim(-.15, .1) +
  theme_bw() +
  theme(legend.position = "bottom", legend.direction = "horizontal", axis.title.x = element_text(size = 11), axis.text.x = element_text(size = 15), axis.title.y = element_text(size = 11), axis.text.y = element_text(size = 15), title = element_text(size = 18), legend.title = element_text(size = 12), legend.text = element_text(size = 12), legend.key = element_blank(), legend.key.width = unit(0.3, 'cm'), legend.key.size = unit(0.1, 'cm'), plot.title = element_text(size = 7.5, face = "bold"), strip.text = element_text(face = "bold", size = 10))
## Warning in stat_smooth(method = "lm", ci = T, color = viridis(5)[3], size = 1):
## Ignoring unknown parameters: `ci`
age.nback.effect.sge_PVRC
## `geom_smooth()` using formula = 'y ~ x'

3.6 Subjective ratings

3.6.1 Workload

# read data
MWdata <- read_excel("/Users/betty/Desktop/Workload(processed).xlsx", sheet=1)

# fit model
Model <- lmer(data = MWdata, meanscore ~ agegroup2*condition*dimension + (1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ agegroup2 * condition * dimension + (1 | sub)
##    Data: MWdata
## 
## REML criterion at convergence: 7615.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.1452 -0.6837 -0.0384  0.6863  2.3401 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 103.8    10.19   
##  Residual             545.9    23.36   
## Number of obs: 870, groups:  sub, 29
## 
## Fixed effects:
##                                                        Estimate Std. Error
## (Intercept)                                             52.8571     6.8121
## agegroup2Y                                              -6.8571     9.4718
## conditioncontrol                                         0.7143     8.8310
## conditionmeaningfully                                   -8.5714     8.8310
## conditionmeaninglessly                                   7.8571     8.8310
## conditionrepeat                                         -1.7033     8.8310
## dimensionfrustration                                   -19.2857     8.8310
## dimensionmental                                         -0.7143     8.8310
## dimensionperformance                                   -16.0714     8.8310
## dimensionphysical                                      -10.0000     8.8310
## dimensiontime                                           -5.7143     8.8310
## agegroup2Y:conditioncontrol                              3.6190    12.2790
## agegroup2Y:conditionmeaningfully                        10.9048    12.2790
## agegroup2Y:conditionmeaninglessly                       -5.1905    12.2790
## agegroup2Y:conditionrepeat                             -11.2967    12.2790
## agegroup2Y:dimensionfrustration                         -8.3810    12.2790
## agegroup2Y:dimensionmental                              13.3810    12.2790
## agegroup2Y:dimensionperformance                          5.4048    12.2790
## agegroup2Y:dimensionphysical                             1.0000    12.2790
## agegroup2Y:dimensiontime                                -2.2857    12.2790
## conditioncontrol:dimensionfrustration                    2.8571    12.4889
## conditionmeaningfully:dimensionfrustration               3.9286    12.4889
## conditionmeaninglessly:dimensionfrustration             -4.6429    12.4889
## conditionrepeat:dimensionfrustration                    -0.7143    12.4889
## conditioncontrol:dimensionmental                        -0.7143    12.4889
## conditionmeaningfully:dimensionmental                   17.1429    12.4889
## conditionmeaninglessly:dimensionmental                 -13.2143    12.4889
## conditionrepeat:dimensionmental                         -3.5165    12.4889
## conditioncontrol:dimensionperformance                    6.4286    12.4889
## conditionmeaningfully:dimensionperformance               9.6429    12.4889
## conditionmeaninglessly:dimensionperformance             -1.4286    12.4889
## conditionrepeat:dimensionperformance                     3.7637    12.4889
## conditioncontrol:dimensionphysical                       6.0714    12.4889
## conditionmeaningfully:dimensionphysical                 15.0000    12.4889
## conditionmeaninglessly:dimensionphysical                -6.7857    12.4889
## conditionrepeat:dimensionphysical                       -3.0769    12.4889
## conditioncontrol:dimensiontime                          -8.9286    12.4889
## conditionmeaningfully:dimensiontime                     -2.5000    12.4889
## conditionmeaninglessly:dimensiontime                    -6.7857    12.4889
## conditionrepeat:dimensiontime                           -0.4396    12.4889
## agegroup2Y:conditioncontrol:dimensionfrustration        15.1429    17.3651
## agegroup2Y:conditionmeaningfully:dimensionfrustration   20.4048    17.3651
## agegroup2Y:conditionmeaninglessly:dimensionfrustration  30.3095    17.3651
## agegroup2Y:conditionrepeat:dimensionfrustration         19.0476    17.3651
## agegroup2Y:conditioncontrol:dimensionmental            -25.6190    17.3651
## agegroup2Y:conditionmeaningfully:dimensionmental       -44.8095    17.3651
## agegroup2Y:conditionmeaninglessly:dimensionmental      -18.7857    17.3651
## agegroup2Y:conditionrepeat:dimensionmental               4.5165    17.3651
## agegroup2Y:conditioncontrol:dimensionperformance         2.9048    17.3651
## agegroup2Y:conditionmeaningfully:dimensionperformance    5.6905    17.3651
## agegroup2Y:conditionmeaninglessly:dimensionperformance  12.7619    17.3651
## agegroup2Y:conditionrepeat:dimensionperformance          4.9030    17.3651
## agegroup2Y:conditioncontrol:dimensionphysical           -1.0714    17.3651
## agegroup2Y:conditionmeaningfully:dimensionphysical     -21.3333    17.3651
## agegroup2Y:conditionmeaninglessly:dimensionphysical      5.7857    17.3651
## agegroup2Y:conditionrepeat:dimensionphysical            15.7436    17.3651
## agegroup2Y:conditioncontrol:dimensiontime                6.5952    17.3651
## agegroup2Y:conditionmeaningfully:dimensiontime           6.8333    17.3651
## agegroup2Y:conditionmeaninglessly:dimensiontime         10.4524    17.3651
## agegroup2Y:conditionrepeat:dimensiontime                 3.1062    17.3651
##                                                              df t value
## (Intercept)                                            465.5954   7.759
## agegroup2Y                                             465.5954  -0.724
## conditioncontrol                                       783.0000   0.081
## conditionmeaningfully                                  783.0000  -0.971
## conditionmeaninglessly                                 783.0000   0.890
## conditionrepeat                                        783.0000  -0.193
## dimensionfrustration                                   783.0000  -2.184
## dimensionmental                                        783.0000  -0.081
## dimensionperformance                                   783.0000  -1.820
## dimensionphysical                                      783.0000  -1.132
## dimensiontime                                          783.0000  -0.647
## agegroup2Y:conditioncontrol                            783.0000   0.295
## agegroup2Y:conditionmeaningfully                       783.0000   0.888
## agegroup2Y:conditionmeaninglessly                      783.0000  -0.423
## agegroup2Y:conditionrepeat                             783.0000  -0.920
## agegroup2Y:dimensionfrustration                        783.0000  -0.683
## agegroup2Y:dimensionmental                             783.0000   1.090
## agegroup2Y:dimensionperformance                        783.0000   0.440
## agegroup2Y:dimensionphysical                           783.0000   0.081
## agegroup2Y:dimensiontime                               783.0000  -0.186
## conditioncontrol:dimensionfrustration                  783.0000   0.229
## conditionmeaningfully:dimensionfrustration             783.0000   0.315
## conditionmeaninglessly:dimensionfrustration            783.0000  -0.372
## conditionrepeat:dimensionfrustration                   783.0000  -0.057
## conditioncontrol:dimensionmental                       783.0000  -0.057
## conditionmeaningfully:dimensionmental                  783.0000   1.373
## conditionmeaninglessly:dimensionmental                 783.0000  -1.058
## conditionrepeat:dimensionmental                        783.0000  -0.282
## conditioncontrol:dimensionperformance                  783.0000   0.515
## conditionmeaningfully:dimensionperformance             783.0000   0.772
## conditionmeaninglessly:dimensionperformance            783.0000  -0.114
## conditionrepeat:dimensionperformance                   783.0000   0.301
## conditioncontrol:dimensionphysical                     783.0000   0.486
## conditionmeaningfully:dimensionphysical                783.0000   1.201
## conditionmeaninglessly:dimensionphysical               783.0000  -0.543
## conditionrepeat:dimensionphysical                      783.0000  -0.246
## conditioncontrol:dimensiontime                         783.0000  -0.715
## conditionmeaningfully:dimensiontime                    783.0000  -0.200
## conditionmeaninglessly:dimensiontime                   783.0000  -0.543
## conditionrepeat:dimensiontime                          783.0000  -0.035
## agegroup2Y:conditioncontrol:dimensionfrustration       783.0000   0.872
## agegroup2Y:conditionmeaningfully:dimensionfrustration  783.0000   1.175
## agegroup2Y:conditionmeaninglessly:dimensionfrustration 783.0000   1.745
## agegroup2Y:conditionrepeat:dimensionfrustration        783.0000   1.097
## agegroup2Y:conditioncontrol:dimensionmental            783.0000  -1.475
## agegroup2Y:conditionmeaningfully:dimensionmental       783.0000  -2.580
## agegroup2Y:conditionmeaninglessly:dimensionmental      783.0000  -1.082
## agegroup2Y:conditionrepeat:dimensionmental             783.0000   0.260
## agegroup2Y:conditioncontrol:dimensionperformance       783.0000   0.167
## agegroup2Y:conditionmeaningfully:dimensionperformance  783.0000   0.328
## agegroup2Y:conditionmeaninglessly:dimensionperformance 783.0000   0.735
## agegroup2Y:conditionrepeat:dimensionperformance        783.0000   0.282
## agegroup2Y:conditioncontrol:dimensionphysical          783.0000  -0.062
## agegroup2Y:conditionmeaningfully:dimensionphysical     783.0000  -1.229
## agegroup2Y:conditionmeaninglessly:dimensionphysical    783.0000   0.333
## agegroup2Y:conditionrepeat:dimensionphysical           783.0000   0.907
## agegroup2Y:conditioncontrol:dimensiontime              783.0000   0.380
## agegroup2Y:conditionmeaningfully:dimensiontime         783.0000   0.394
## agegroup2Y:conditionmeaninglessly:dimensiontime        783.0000   0.602
## agegroup2Y:conditionrepeat:dimensiontime               783.0000   0.179
##                                                        Pr(>|t|)    
## (Intercept)                                            5.45e-14 ***
## agegroup2Y                                               0.4695    
## conditioncontrol                                         0.9356    
## conditionmeaningfully                                    0.3320    
## conditionmeaninglessly                                   0.3739    
## conditionrepeat                                          0.8471    
## dimensionfrustration                                     0.0293 *  
## dimensionmental                                          0.9356    
## dimensionperformance                                     0.0692 .  
## dimensionphysical                                        0.2578    
## dimensiontime                                            0.5178    
## agegroup2Y:conditioncontrol                              0.7683    
## agegroup2Y:conditionmeaningfully                         0.3748    
## agegroup2Y:conditionmeaninglessly                        0.6726    
## agegroup2Y:conditionrepeat                               0.3579    
## agegroup2Y:dimensionfrustration                          0.4951    
## agegroup2Y:dimensionmental                               0.2762    
## agegroup2Y:dimensionperformance                          0.6599    
## agegroup2Y:dimensionphysical                             0.9351    
## agegroup2Y:dimensiontime                                 0.8524    
## conditioncontrol:dimensionfrustration                    0.8191    
## conditionmeaningfully:dimensionfrustration               0.7532    
## conditionmeaninglessly:dimensionfrustration              0.7102    
## conditionrepeat:dimensionfrustration                     0.9544    
## conditioncontrol:dimensionmental                         0.9544    
## conditionmeaningfully:dimensionmental                    0.1703    
## conditionmeaninglessly:dimensionmental                   0.2903    
## conditionrepeat:dimensionmental                          0.7783    
## conditioncontrol:dimensionperformance                    0.6069    
## conditionmeaningfully:dimensionperformance               0.4403    
## conditionmeaninglessly:dimensionperformance              0.9090    
## conditionrepeat:dimensionperformance                     0.7632    
## conditioncontrol:dimensionphysical                       0.6270    
## conditionmeaningfully:dimensionphysical                  0.2301    
## conditionmeaninglessly:dimensionphysical                 0.5871    
## conditionrepeat:dimensionphysical                        0.8055    
## conditioncontrol:dimensiontime                           0.4749    
## conditionmeaningfully:dimensiontime                      0.8414    
## conditionmeaninglessly:dimensiontime                     0.5871    
## conditionrepeat:dimensiontime                            0.9719    
## agegroup2Y:conditioncontrol:dimensionfrustration         0.3835    
## agegroup2Y:conditionmeaningfully:dimensionfrustration    0.2403    
## agegroup2Y:conditionmeaninglessly:dimensionfrustration   0.0813 .  
## agegroup2Y:conditionrepeat:dimensionfrustration          0.2730    
## agegroup2Y:conditioncontrol:dimensionmental              0.1405    
## agegroup2Y:conditionmeaningfully:dimensionmental         0.0100 *  
## agegroup2Y:conditionmeaninglessly:dimensionmental        0.2797    
## agegroup2Y:conditionrepeat:dimensionmental               0.7949    
## agegroup2Y:conditioncontrol:dimensionperformance         0.8672    
## agegroup2Y:conditionmeaningfully:dimensionperformance    0.7432    
## agegroup2Y:conditionmeaninglessly:dimensionperformance   0.4626    
## agegroup2Y:conditionrepeat:dimensionperformance          0.7778    
## agegroup2Y:conditioncontrol:dimensionphysical            0.9508    
## agegroup2Y:conditionmeaningfully:dimensionphysical       0.2196    
## agegroup2Y:conditionmeaninglessly:dimensionphysical      0.7391    
## agegroup2Y:conditionrepeat:dimensionphysical             0.3649    
## agegroup2Y:conditioncontrol:dimensiontime                0.7042    
## agegroup2Y:conditionmeaningfully:dimensiontime           0.6941    
## agegroup2Y:conditionmeaninglessly:dimensiontime          0.5474    
## agegroup2Y:conditionrepeat:dimensiontime                 0.8581    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 60 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##                                Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## agegroup2                       512.8   512.8     1    27  0.9393   0.34106    
## condition                      6341.8  1585.4     4   783  2.9042   0.02106 *  
## dimension                     18533.7  3706.7     5   783  6.7901 3.283e-06 ***
## agegroup2:condition            1929.1   482.3     4   783  0.8834   0.47329    
## agegroup2:dimension            5297.1  1059.4     5   783  1.9406   0.08540 .  
## condition:dimension           14045.6   702.3    20   783  1.2864   0.17927    
## agegroup2:condition:dimension 16217.7   810.9    20   783  1.4854   0.07852 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# the post hoc analysis for the main effect of countermeasure type
pwc.workload.condition <- MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE)
pwc.workload.condition 
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…   174   174   -1.48     173 0.14  1     ns          
##  2 meanscore answer  meani…   174   174   -0.601    173 0.549 1     ns          
##  3 meanscore answer  meani…   174   174   -1.12     173 0.266 1     ns          
##  4 meanscore answer  repeat   174   174    1.99     173 0.048 0.477 ns          
##  5 meanscore control meani…   174   174    0.912    173 0.363 1     ns          
##  6 meanscore control meani…   174   174    0.0695   173 0.945 1     ns          
##  7 meanscore control repeat   174   174    3.26     173 0.001 0.013 *           
##  8 meanscore meanin… meani…   174   174   -0.737    173 0.462 1     ns          
##  9 meanscore meanin… repeat   174   174    2.13     173 0.035 0.349 ns          
## 10 meanscore meanin… repeat   174   174    2.55     173 0.012 0.117 ns
# the post hoc analysis for the main effect of workload dimension
pwc.workload.dimension <- MWdata %>% pairwise_t_test(meanscore ~ dimension, p.adjust.method = "bonferroni", paired = TRUE) 
pwc.workload.dimension
## # A tibble: 15 × 10
##    .y.    group1 group2    n1    n2 statistic    df       p   p.adj p.adj.signif
##  * <chr>  <chr>  <chr>  <int> <int>     <dbl> <dbl>   <dbl>   <dbl> <chr>       
##  1 means… effort frust…   145   145     6.47    144 1.46e-9 2.19e-8 ****        
##  2 means… effort mental   145   145     1.13    144 2.6 e-1 1   e+0 ns          
##  3 means… effort perfo…   145   145     2.88    144 5   e-3 6.8 e-2 ns          
##  4 means… effort physi…   145   145     3.07    144 3   e-3 3.9 e-2 *           
##  5 means… effort time     145   145     4.53    144 1.25e-5 1.88e-4 ***         
##  6 means… frust… mental   145   145    -3.96    144 1.2 e-4 2   e-3 **          
##  7 means… frust… perfo…   145   145    -4.85    144 3.21e-6 4.82e-5 ****        
##  8 means… frust… physi…   145   145    -2.86    144 5   e-3 7.3 e-2 ns          
##  9 means… frust… time     145   145    -3.39    144 8.89e-4 1.3 e-2 *           
## 10 means… mental perfo…   145   145     1.41    144 1.62e-1 1   e+0 ns          
## 11 means… mental physi…   145   145     1.63    144 1.05e-1 1   e+0 ns          
## 12 means… mental time     145   145     2.04    144 4.3 e-2 6.49e-1 ns          
## 13 means… perfo… physi…   145   145     0.190   144 8.49e-1 1   e+0 ns          
## 14 means… perfo… time     145   145     0.495   144 6.21e-1 1   e+0 ns          
## 15 means… physi… time     145   145     0.227   144 8.21e-1 1   e+0 ns
# the simple simple effect analysis for the interaction effect of age group, countermeasure type, and workload dimension
## younger drivers (condition X dimension)
filter.age.Y <- filter(MWdata,agegroup2 =="Y") 
### fit model
Model <- lmer(data = filter.age.Y, meanscore~condition*dimension+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition * dimension + (1 | sub)
##    Data: filter.age.Y
## 
## REML criterion at convergence: 4003.3
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.86685 -0.74177 -0.04496  0.71066  2.13181 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept)  39.58    6.292  
##  Residual             642.60   25.350  
## Number of obs: 450, groups:  sub, 15
## 
## Fixed effects:
##                                             Estimate Std. Error      df t value
## (Intercept)                                   46.000      6.744 382.639   6.821
## conditioncontrol                               4.333      9.256 406.000   0.468
## conditionmeaningfully                          2.333      9.256 406.000   0.252
## conditionmeaninglessly                         2.667      9.256 406.000   0.288
## conditionrepeat                              -13.000      9.256 406.000  -1.404
## dimensionfrustration                         -27.667      9.256 406.000  -2.989
## dimensionmental                               12.667      9.256 406.000   1.368
## dimensionperformance                         -10.667      9.256 406.000  -1.152
## dimensionphysical                             -9.000      9.256 406.000  -0.972
## dimensiontime                                 -8.000      9.256 406.000  -0.864
## conditioncontrol:dimensionfrustration         18.000     13.090 406.000   1.375
## conditionmeaningfully:dimensionfrustration    24.333     13.090 406.000   1.859
## conditionmeaninglessly:dimensionfrustration   25.667     13.090 406.000   1.961
## conditionrepeat:dimensionfrustration          18.333     13.090 406.000   1.401
## conditioncontrol:dimensionmental             -26.333     13.090 406.000  -2.012
## conditionmeaningfully:dimensionmental        -27.667     13.090 406.000  -2.114
## conditionmeaninglessly:dimensionmental       -32.000     13.090 406.000  -2.445
## conditionrepeat:dimensionmental                1.000     13.090 406.000   0.076
## conditioncontrol:dimensionperformance          9.333     13.090 406.000   0.713
## conditionmeaningfully:dimensionperformance    15.333     13.090 406.000   1.171
## conditionmeaninglessly:dimensionperformance   11.333     13.090 406.000   0.866
## conditionrepeat:dimensionperformance           8.667     13.090 406.000   0.662
## conditioncontrol:dimensionphysical             5.000     13.090 406.000   0.382
## conditionmeaningfully:dimensionphysical       -6.333     13.090 406.000  -0.484
## conditionmeaninglessly:dimensionphysical      -1.000     13.090 406.000  -0.076
## conditionrepeat:dimensionphysical             12.667     13.090 406.000   0.968
## conditioncontrol:dimensiontime                -2.333     13.090 406.000  -0.178
## conditionmeaningfully:dimensiontime            4.333     13.090 406.000   0.331
## conditionmeaninglessly:dimensiontime           3.667     13.090 406.000   0.280
## conditionrepeat:dimensiontime                  2.667     13.090 406.000   0.204
##                                             Pr(>|t|)    
## (Intercept)                                 3.54e-11 ***
## conditioncontrol                             0.63993    
## conditionmeaningfully                        0.80111    
## conditionmeaninglessly                       0.77342    
## conditionrepeat                              0.16095    
## dimensionfrustration                         0.00297 ** 
## dimensionmental                              0.17193    
## dimensionperformance                         0.24985    
## dimensionphysical                            0.33148    
## dimensiontime                                0.38795    
## conditioncontrol:dimensionfrustration        0.16987    
## conditionmeaningfully:dimensionfrustration   0.06377 .  
## conditionmeaninglessly:dimensionfrustration  0.05060 .  
## conditionrepeat:dimensionfrustration         0.16212    
## conditioncontrol:dimensionmental             0.04492 *  
## conditionmeaningfully:dimensionmental        0.03517 *  
## conditionmeaninglessly:dimensionmental       0.01493 *  
## conditionrepeat:dimensionmental              0.93915    
## conditioncontrol:dimensionperformance        0.47626    
## conditionmeaningfully:dimensionperformance   0.24215    
## conditionmeaninglessly:dimensionperformance  0.38713    
## conditionrepeat:dimensionperformance         0.50831    
## conditioncontrol:dimensionphysical           0.70269    
## conditionmeaningfully:dimensionphysical      0.62878    
## conditionmeaninglessly:dimensionphysical     0.93915    
## conditionrepeat:dimensionphysical            0.33381    
## conditioncontrol:dimensiontime               0.85862    
## conditionmeaningfully:dimensiontime          0.74079    
## conditionmeaninglessly:dimensiontime         0.77954    
## conditionrepeat:dimensiontime                0.83868    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 30 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##                      Sum Sq Mean Sq NumDF DenDF F value  Pr(>F)  
## condition            7134.8  1783.7     4   406  2.7757 0.02678 *
## dimension            5308.4  1061.7     5   406  1.6522 0.14513  
## condition:dimension 24296.6  1214.8    20   406  1.8905 0.01189 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
### pairwise comparisons of five countermeasure types under different workload dimensions
#### (1) mental
filter1.MWdata<- filter(filter.age.Y, dimension =="mental") 
library(lmerTest)
Model <- lmer(data = filter1.MWdata, meanscore~condition+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter1.MWdata
## 
## REML criterion at convergence: 667
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.67994 -0.65291 -0.08546  0.59523  2.26289 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 202.5    14.23   
##  Residual             536.3    23.16   
## Number of obs: 75, groups:  sub, 15
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)              58.667      7.018  53.823   8.359 2.67e-11 ***
## conditioncontrol        -22.000      8.456  56.000  -2.602  0.01185 *  
## conditionmeaningfully   -25.333      8.456  56.000  -2.996  0.00407 ** 
## conditionmeaninglessly  -29.333      8.456  56.000  -3.469  0.00101 ** 
## conditionrepeat         -12.000      8.456  56.000  -1.419  0.16141    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.602                             
## cndtnmnngfl -0.602  0.500                      
## cndtnmnngls -0.602  0.500  0.500               
## conditinrpt -0.602  0.500  0.500      0.500
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value   Pr(>F)   
## condition   8368    2092     4    56  3.9009 0.007285 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pwc <- filter1.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    15    15     2.11     14 0.053 0.534 ns          
##  2 meanscore answer  meani…    15    15     3.11     14 0.008 0.078 ns          
##  3 meanscore answer  meani…    15    15     2.90     14 0.012 0.117 ns          
##  4 meanscore answer  repeat    15    15     1.44     14 0.173 1     ns          
##  5 meanscore control meani…    15    15     0.353    14 0.729 1     ns          
##  6 meanscore control meani…    15    15     0.791    14 0.442 1     ns          
##  7 meanscore control repeat    15    15    -1.36     14 0.195 1     ns          
##  8 meanscore meanin… meani…    15    15     0.574    14 0.575 1     ns          
##  9 meanscore meanin… repeat    15    15    -2.53     14 0.024 0.24  ns          
## 10 meanscore meanin… repeat    15    15    -2.20     14 0.045 0.448 ns
#### (2) physical
filter2.MWdata<- filter(filter.age.Y, dimension =="physical") 
Model <- lmer(data = filter2.MWdata, meanscore~condition+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter2.MWdata
## 
## REML criterion at convergence: 658.8
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.41484 -0.55039  0.00662  0.64018  1.86472 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 379.9    19.49   
##  Residual             418.8    20.46   
## Number of obs: 75, groups:  sub, 15
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             37.0000     7.2971 36.7463   5.071 1.15e-05 ***
## conditioncontrol         9.3333     7.4727 56.0000   1.249    0.217    
## conditionmeaningfully   -4.0000     7.4727 56.0000  -0.535    0.595    
## conditionmeaninglessly   1.6667     7.4727 56.0000   0.223    0.824    
## conditionrepeat         -0.3333     7.4727 56.0000  -0.045    0.965    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.512                             
## cndtnmnngfl -0.512  0.500                      
## cndtnmnngls -0.512  0.500  0.500               
## conditinrpt -0.512  0.500  0.500      0.500
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 1456.7  364.17     4    56  0.8695  0.488
pwc <- filter2.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    15    15   -1.66      14 0.119 1     ns          
##  2 meanscore answer  meani…    15    15    0.616     14 0.548 1     ns          
##  3 meanscore answer  meani…    15    15   -0.254     14 0.803 1     ns          
##  4 meanscore answer  repeat    15    15    0.0461    14 0.964 1     ns          
##  5 meanscore control meani…    15    15    1.91      14 0.076 0.762 ns          
##  6 meanscore control meani…    15    15    1.02      14 0.324 1     ns          
##  7 meanscore control repeat    15    15    1.16      14 0.264 1     ns          
##  8 meanscore meanin… meani…    15    15   -0.918     14 0.374 1     ns          
##  9 meanscore meanin… repeat    15    15   -0.380     14 0.71  1     ns          
## 10 meanscore meanin… repeat    15    15    0.218     14 0.831 1     ns
#### (3) time
filter3.MWdata<- filter(filter.age.Y, dimension =="time") 
Model <- lmer(data = filter3.MWdata, meanscore~condition+(1|sub))
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter3.MWdata
## 
## REML criterion at convergence: 651.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9257 -0.8398 -0.1158  0.8832  1.8388 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept)   0       0.00   
##  Residual             530      23.02   
## Number of obs: 75, groups:  sub, 15
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)              38.000      5.944  70.000   6.393 1.57e-08 ***
## conditioncontrol          2.000      8.406  70.000   0.238    0.813    
## conditionmeaningfully     6.667      8.406  70.000   0.793    0.430    
## conditionmeaninglessly    6.333      8.406  70.000   0.753    0.454    
## conditionrepeat         -10.333      8.406  70.000  -1.229    0.223    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.707                             
## cndtnmnngfl -0.707  0.500                      
## cndtnmnngls -0.707  0.500  0.500               
## conditinrpt -0.707  0.500  0.500      0.500    
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 2864.7  716.17     4    70  1.3513 0.2598
pwc <- filter3.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    15    15   -0.276     14 0.787 1     ns          
##  2 meanscore answer  meani…    15    15   -0.974     14 0.346 1     ns          
##  3 meanscore answer  meani…    15    15   -0.616     14 0.548 1     ns          
##  4 meanscore answer  repeat    15    15    1.73      14 0.105 1     ns          
##  5 meanscore control meani…    15    15   -0.538     14 0.599 1     ns          
##  6 meanscore control meani…    15    15   -0.409     14 0.689 1     ns          
##  7 meanscore control repeat    15    15    1.56      14 0.141 1     ns          
##  8 meanscore meanin… meani…    15    15    0.0325    14 0.975 1     ns          
##  9 meanscore meanin… repeat    15    15    2.46      14 0.028 0.276 ns          
## 10 meanscore meanin… repeat    15    15    1.77      14 0.098 0.982 ns
#### (4) effort
filter4.MWdata<- filter(filter.age.Y, dimension =="effort") 
Model <- lmer(data = filter4.MWdata, meanscore~condition+(1|sub))
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter4.MWdata
## 
## REML criterion at convergence: 675
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.6009 -0.9288  0.2322  0.7088  1.8209 
## 
## Random effects:
##  Groups   Name        Variance  Std.Dev. 
##  sub      (Intercept) 8.045e-13 8.970e-07
##  Residual             7.440e+02 2.728e+01
## Number of obs: 75, groups:  sub, 15
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)              46.000      7.043  70.000   6.532 8.82e-09 ***
## conditioncontrol          4.333      9.960  70.000   0.435    0.665    
## conditionmeaningfully     2.333      9.960  70.000   0.234    0.815    
## conditionmeaninglessly    2.667      9.960  70.000   0.268    0.790    
## conditionrepeat         -13.000      9.960  70.000  -1.305    0.196    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.707                             
## cndtnmnngfl -0.707  0.500                      
## cndtnmnngls -0.707  0.500  0.500               
## conditinrpt -0.707  0.500  0.500      0.500    
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 2964.7  741.17     4    70  0.9962 0.4155
pwc <- filter4.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    15    15   -0.496     14 0.628 1     ns          
##  2 meanscore answer  meani…    15    15   -0.300     14 0.768 1     ns          
##  3 meanscore answer  meani…    15    15   -0.226     14 0.825 1     ns          
##  4 meanscore answer  repeat    15    15    1.67      14 0.117 1     ns          
##  5 meanscore control meani…    15    15    0.207     14 0.839 1     ns          
##  6 meanscore control meani…    15    15    0.136     14 0.894 1     ns          
##  7 meanscore control repeat    15    15    2.36      14 0.033 0.334 ns          
##  8 meanscore meanin… meani…    15    15   -0.0289    14 0.977 1     ns          
##  9 meanscore meanin… repeat    15    15    1.55      14 0.143 1     ns          
## 10 meanscore meanin… repeat    15    15    1.33      14 0.203 1     ns
#### (5) frustration
filter5.MWdata<- filter(filter.age.Y, dimension =="frustration") 
Model <- lmer(data = filter5.MWdata, meanscore~condition+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter5.MWdata
## 
## REML criterion at convergence: 665.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.7843 -0.7922 -0.0414  0.5754  1.9991 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept)  61.11    7.817  
##  Residual             600.80   24.511  
## Number of obs: 75, groups:  sub, 15
## 
## Fixed effects:
##                        Estimate Std. Error     df t value Pr(>|t|)   
## (Intercept)              18.333      6.643 67.692   2.760  0.00743 **
## conditioncontrol         22.333      8.950 56.000   2.495  0.01556 * 
## conditionmeaningfully    26.667      8.950 56.000   2.979  0.00426 **
## conditionmeaninglessly   28.333      8.950 56.000   3.166  0.00250 **
## conditionrepeat           5.333      8.950 56.000   0.596  0.55365   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.674                             
## cndtnmnngfl -0.674  0.500                      
## cndtnmnngls -0.674  0.500  0.500               
## conditinrpt -0.674  0.500  0.500      0.500
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value   Pr(>F)   
## condition  10115  2528.8     4    56  4.2091 0.004753 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pwc <- filter5.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    15    15    -2.96     14 0.01  0.104 ns          
##  2 meanscore answer  meani…    15    15    -2.91     14 0.011 0.113 ns          
##  3 meanscore answer  meani…    15    15    -3.16     14 0.007 0.069 ns          
##  4 meanscore answer  repeat    15    15    -0.764    14 0.457 1     ns          
##  5 meanscore control meani…    15    15    -0.541    14 0.597 1     ns          
##  6 meanscore control meani…    15    15    -0.645    14 0.529 1     ns          
##  7 meanscore control repeat    15    15     2.39     14 0.032 0.316 ns          
##  8 meanscore meanin… meani…    15    15    -0.156    14 0.878 1     ns          
##  9 meanscore meanin… repeat    15    15     1.99     14 0.066 0.664 ns          
## 10 meanscore meanin… repeat    15    15     2.28     14 0.039 0.387 ns
#### (6) performance
filter6.MWdata<- filter(filter.age.Y, dimension =="performance")
Model <- lmer(data = filter6.MWdata, meanscore~condition+(1|sub))
## boundary (singular) fit: see help('isSingular')
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter6.MWdata
## 
## REML criterion at convergence: 662.2
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.78095 -0.68292  0.02678  0.76326  1.96842 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept)   0.0     0.00   
##  Residual             619.7    24.89   
## Number of obs: 75, groups:  sub, 15
## 
## Fixed effects:
##                        Estimate Std. Error     df t value Pr(>|t|)    
## (Intercept)              35.333      6.427 70.000   5.497 5.89e-07 ***
## conditioncontrol         13.667      9.090 70.000   1.504    0.137    
## conditionmeaningfully    17.667      9.090 70.000   1.944    0.056 .  
## conditionmeaninglessly   14.000      9.090 70.000   1.540    0.128    
## conditionrepeat          -4.333      9.090 70.000  -0.477    0.635    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.707                             
## cndtnmnngfl -0.707  0.500                      
## cndtnmnngls -0.707  0.500  0.500               
## conditinrpt -0.707  0.500  0.500      0.500    
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value  Pr(>F)  
## condition   5662  1415.5     4    70  2.2843 0.06881 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
pwc <- filter6.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    15    15   -1.39      14 0.187 1     ns          
##  2 meanscore answer  meani…    15    15   -1.66      14 0.119 1     ns          
##  3 meanscore answer  meani…    15    15   -1.17      14 0.261 1     ns          
##  4 meanscore answer  repeat    15    15    0.573     14 0.575 1     ns          
##  5 meanscore control meani…    15    15   -0.475     14 0.642 1     ns          
##  6 meanscore control meani…    15    15   -0.0387    14 0.97  1     ns          
##  7 meanscore control repeat    15    15    1.94      14 0.073 0.729 ns          
##  8 meanscore meanin… meani…    15    15    0.458     14 0.654 1     ns          
##  9 meanscore meanin… repeat    15    15    2.04      14 0.06  0.605 ns          
## 10 meanscore meanin… repeat    15    15    1.80      14 0.093 0.931 ns
## middle-aged drivers (condition X dimension)
filter.age.M <- filter(MWdata,agegroup2 =="M") 
### fit model
Model <- lmer(data = filter.age.M, meanscore~condition*dimension+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition * dimension + (1 | sub)
##    Data: filter.age.M
## 
## REML criterion at convergence: 3594.4
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.36082 -0.64771 -0.01516  0.67881  2.54687 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 172.9    13.15   
##  Residual             441.8    21.02   
## Number of obs: 420, groups:  sub, 14
## 
## Fixed effects:
##                                             Estimate Std. Error       df
## (Intercept)                                  52.8571     6.6259 118.3993
## conditioncontrol                              0.7143     7.9442 377.0000
## conditionmeaningfully                        -8.5714     7.9442 377.0000
## conditionmeaninglessly                        7.8571     7.9442 377.0000
## conditionrepeat                              -1.7033     7.9442 377.0000
## dimensionfrustration                        -19.2857     7.9442 377.0000
## dimensionmental                              -0.7143     7.9442 377.0000
## dimensionperformance                        -16.0714     7.9442 377.0000
## dimensionphysical                           -10.0000     7.9442 377.0000
## dimensiontime                                -5.7143     7.9442 377.0000
## conditioncontrol:dimensionfrustration         2.8571    11.2348 377.0000
## conditionmeaningfully:dimensionfrustration    3.9286    11.2348 377.0000
## conditionmeaninglessly:dimensionfrustration  -4.6429    11.2348 377.0000
## conditionrepeat:dimensionfrustration         -0.7143    11.2348 377.0000
## conditioncontrol:dimensionmental             -0.7143    11.2348 377.0000
## conditionmeaningfully:dimensionmental        17.1429    11.2348 377.0000
## conditionmeaninglessly:dimensionmental      -13.2143    11.2348 377.0000
## conditionrepeat:dimensionmental              -3.5165    11.2348 377.0000
## conditioncontrol:dimensionperformance         6.4286    11.2348 377.0000
## conditionmeaningfully:dimensionperformance    9.6429    11.2348 377.0000
## conditionmeaninglessly:dimensionperformance  -1.4286    11.2348 377.0000
## conditionrepeat:dimensionperformance          3.7637    11.2348 377.0000
## conditioncontrol:dimensionphysical            6.0714    11.2348 377.0000
## conditionmeaningfully:dimensionphysical      15.0000    11.2348 377.0000
## conditionmeaninglessly:dimensionphysical     -6.7857    11.2348 377.0000
## conditionrepeat:dimensionphysical            -3.0769    11.2348 377.0000
## conditioncontrol:dimensiontime               -8.9286    11.2348 377.0000
## conditionmeaningfully:dimensiontime          -2.5000    11.2348 377.0000
## conditionmeaninglessly:dimensiontime         -6.7857    11.2348 377.0000
## conditionrepeat:dimensiontime                -0.4396    11.2348 377.0000
##                                             t value Pr(>|t|)    
## (Intercept)                                   7.977 1.06e-12 ***
## conditioncontrol                              0.090   0.9284    
## conditionmeaningfully                        -1.079   0.2813    
## conditionmeaninglessly                        0.989   0.3233    
## conditionrepeat                              -0.214   0.8303    
## dimensionfrustration                         -2.428   0.0157 *  
## dimensionmental                              -0.090   0.9284    
## dimensionperformance                         -2.023   0.0438 *  
## dimensionphysical                            -1.259   0.2089    
## dimensiontime                                -0.719   0.4724    
## conditioncontrol:dimensionfrustration         0.254   0.7994    
## conditionmeaningfully:dimensionfrustration    0.350   0.7268    
## conditionmeaninglessly:dimensionfrustration  -0.413   0.6797    
## conditionrepeat:dimensionfrustration         -0.064   0.9493    
## conditioncontrol:dimensionmental             -0.064   0.9493    
## conditionmeaningfully:dimensionmental         1.526   0.1279    
## conditionmeaninglessly:dimensionmental       -1.176   0.2403    
## conditionrepeat:dimensionmental              -0.313   0.7545    
## conditioncontrol:dimensionperformance         0.572   0.5675    
## conditionmeaningfully:dimensionperformance    0.858   0.3913    
## conditionmeaninglessly:dimensionperformance  -0.127   0.8989    
## conditionrepeat:dimensionperformance          0.335   0.7378    
## conditioncontrol:dimensionphysical            0.540   0.5892    
## conditionmeaningfully:dimensionphysical       1.335   0.1826    
## conditionmeaninglessly:dimensionphysical     -0.604   0.5462    
## conditionrepeat:dimensionphysical            -0.274   0.7843    
## conditioncontrol:dimensiontime               -0.795   0.4273    
## conditionmeaningfully:dimensiontime          -0.223   0.8240    
## conditionmeaninglessly:dimensiontime         -0.604   0.5462    
## conditionrepeat:dimensiontime                -0.039   0.9688    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 30 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##                      Sum Sq Mean Sq NumDF DenDF F value    Pr(>F)    
## condition            1336.0   334.0     4   377  0.7561    0.5545    
## dimension           18081.9  3616.4     5   377  8.1860 2.364e-07 ***
## condition:dimension  6577.7   328.9    20   377  0.7445    0.7793    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
### pairwise comparisons of five countermeasure types under different workload dimensions
#### (1) mental
filter1.MWdata<- filter(filter.age.M, dimension =="mental") 
Model <- lmer(data = filter1.MWdata, meanscore~condition+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter1.MWdata
## 
## REML criterion at convergence: 630.9
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.86611 -0.77014  0.00712  0.73527  1.70739 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 153.8    12.40   
##  Residual             674.2    25.97   
## Number of obs: 70, groups:  sub, 14
## 
## Fixed effects:
##                          Estimate Std. Error         df t value Pr(>|t|)    
## (Intercept)             5.214e+01  7.691e+00  5.712e+01   6.780 7.33e-09 ***
## conditioncontrol       -1.340e-14  9.814e+00  5.200e+01   0.000    1.000    
## conditionmeaningfully   8.571e+00  9.814e+00  5.200e+01   0.873    0.386    
## conditionmeaninglessly -5.357e+00  9.814e+00  5.200e+01  -0.546    0.587    
## conditionrepeat        -5.220e+00  9.814e+00  5.200e+01  -0.532    0.597    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.638                             
## cndtnmnngfl -0.638  0.500                      
## cndtnmnngls -0.638  0.500  0.500               
## conditinrpt -0.638  0.500  0.500      0.500
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 1800.5  450.14     4    52  0.6676 0.6173
pwc <- filter1.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    14    14    0         13 1         1 ns          
##  2 meanscore answer  meani…    14    14   -1.05      13 0.314     1 ns          
##  3 meanscore answer  meani…    14    14    0.467     13 0.648     1 ns          
##  4 meanscore answer  repeat    14    14    0.472     13 0.645     1 ns          
##  5 meanscore control meani…    14    14   -1.16      13 0.265     1 ns          
##  6 meanscore control meani…    14    14    0.648     13 0.528     1 ns          
##  7 meanscore control repeat    14    14    0.462     13 0.652     1 ns          
##  8 meanscore meanin… meani…    14    14    1.66      13 0.121     1 ns          
##  9 meanscore meanin… repeat    14    14    1.21      13 0.249     1 ns          
## 10 meanscore meanin… repeat    14    14   -0.0114    13 0.991     1 ns
#### (2) physical
filter2.MWdata<- filter(filter.age.M, dimension =="physical") 
Model <- lmer(data = filter2.MWdata, meanscore~condition+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter2.MWdata
## 
## REML criterion at convergence: 608
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.3478 -0.5353 -0.0379  0.6914  1.8982 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 321.0    17.92   
##  Residual             399.6    19.99   
## Number of obs: 70, groups:  sub, 14
## 
## Fixed effects:
##                        Estimate Std. Error     df t value Pr(>|t|)    
## (Intercept)              42.857      7.174 36.239   5.974 7.35e-07 ***
## conditioncontrol          6.786      7.556 52.000   0.898    0.373    
## conditionmeaningfully     6.429      7.556 52.000   0.851    0.399    
## conditionmeaninglessly    1.071      7.556 52.000   0.142    0.888    
## conditionrepeat          -4.780      7.556 52.000  -0.633    0.530    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.527                             
## cndtnmnngfl -0.527  0.500                      
## cndtnmnngls -0.527  0.500  0.500               
## conditinrpt -0.527  0.500  0.500      0.500
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 1306.2  326.55     4    52  0.8172 0.5201
pwc <- filter2.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    14    14   -0.842     13 0.415 1     ns          
##  2 meanscore answer  meani…    14    14   -0.956     13 0.356 1     ns          
##  3 meanscore answer  meani…    14    14   -0.117     13 0.908 1     ns          
##  4 meanscore answer  repeat    14    14    0.783     13 0.448 1     ns          
##  5 meanscore control meani…    14    14    0.0660    13 0.948 1     ns          
##  6 meanscore control meani…    14    14    0.688     13 0.503 1     ns          
##  7 meanscore control repeat    14    14    1.79      13 0.097 0.967 ns          
##  8 meanscore meanin… meani…    14    14    0.660     13 0.52  1     ns          
##  9 meanscore meanin… repeat    14    14    1.47      13 0.165 1     ns          
## 10 meanscore meanin… repeat    14    14    0.670     13 0.514 1     ns
#### (3) time
filter3.MWdata<- filter(filter.age.M, dimension =="time") 
Model <- lmer(data = filter3.MWdata, meanscore~condition+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter3.MWdata
## 
## REML criterion at convergence: 580
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.93772 -0.59329  0.05874  0.63833  1.93671 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 135.3    11.63   
##  Residual             280.6    16.75   
## Number of obs: 70, groups:  sub, 14
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)              47.143      5.450  45.659   8.649 3.54e-11 ***
## conditioncontrol         -8.214      6.331  52.000  -1.297   0.2002    
## conditionmeaningfully   -11.071      6.331  52.000  -1.749   0.0862 .  
## conditionmeaninglessly    1.071      6.331  52.000   0.169   0.8663    
## conditionrepeat          -2.143      6.331  52.000  -0.338   0.7364    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.581                             
## cndtnmnngfl -0.581  0.500                      
## cndtnmnngls -0.581  0.500  0.500               
## conditinrpt -0.581  0.500  0.500      0.500
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 1580.7  395.18     4    52  1.4085 0.2441
pwc <- filter3.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    14    14     1.24     13 0.235 1     ns          
##  2 meanscore answer  meani…    14    14     1.62     13 0.128 1     ns          
##  3 meanscore answer  meani…    14    14    -0.140    13 0.891 1     ns          
##  4 meanscore answer  repeat    14    14     0.442    13 0.666 1     ns          
##  5 meanscore control meani…    14    14     0.528    13 0.607 1     ns          
##  6 meanscore control meani…    14    14    -1.43     13 0.177 1     ns          
##  7 meanscore control repeat    14    14    -1.15     13 0.272 1     ns          
##  8 meanscore meanin… meani…    14    14    -1.82     13 0.092 0.925 ns          
##  9 meanscore meanin… repeat    14    14    -1.56     13 0.143 1     ns          
## 10 meanscore meanin… repeat    14    14     0.449    13 0.661 1     ns
#### (4) effort
filter4.MWdata<- filter(filter.age.M, dimension =="effort") 
Model <- lmer(data = filter4.MWdata, meanscore~condition+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter4.MWdata
## 
## REML criterion at convergence: 604.5
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.00403 -0.74826  0.07516  0.60586  1.72410 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 186.0    13.64   
##  Residual             413.3    20.33   
## Number of obs: 70, groups:  sub, 14
## 
## Fixed effects:
##                        Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)             52.8571     6.5424 46.9252   8.079 1.96e-10 ***
## conditioncontrol         0.7143     7.6838 52.0000   0.093    0.926    
## conditionmeaningfully   -8.5714     7.6838 52.0000  -1.116    0.270    
## conditionmeaninglessly   7.8571     7.6838 52.0000   1.023    0.311    
## conditionrepeat         -1.7033     7.6838 52.0000  -0.222    0.825    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.587                             
## cndtnmnngfl -0.587  0.500                      
## cndtnmnngls -0.587  0.500  0.500               
## conditinrpt -0.587  0.500  0.500      0.500
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 1932.5  483.12     4    52   1.169 0.3352
pwc <- filter4.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    14    14    -0.122    13 0.905 1     ns          
##  2 meanscore answer  meani…    14    14     1.27     13 0.226 1     ns          
##  3 meanscore answer  meani…    14    14    -0.878    13 0.396 1     ns          
##  4 meanscore answer  repeat    14    14     0.247    13 0.809 1     ns          
##  5 meanscore control meani…    14    14     1.71     13 0.11  1     ns          
##  6 meanscore control meani…    14    14    -0.790    13 0.444 1     ns          
##  7 meanscore control repeat    14    14     0.317    13 0.756 1     ns          
##  8 meanscore meanin… meani…    14    14    -2.36     13 0.035 0.346 ns          
##  9 meanscore meanin… repeat    14    14    -0.845    13 0.413 1     ns          
## 10 meanscore meanin… repeat    14    14     0.960    13 0.355 1     ns
#### (5) frustration
filter5.MWdata<- filter(filter.age.M, dimension =="frustration") 
Model <- lmer(data = filter5.MWdata, meanscore~condition+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter5.MWdata
## 
## REML criterion at convergence: 593.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0913 -0.5418 -0.1313  0.4585  3.0320 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 156.3    12.50   
##  Residual             348.4    18.67   
## Number of obs: 70, groups:  sub, 14
## 
## Fixed effects:
##                        Estimate Std. Error     df t value Pr(>|t|)    
## (Intercept)              33.571      6.004 46.985   5.591 1.11e-06 ***
## conditioncontrol          3.571      7.055 52.000   0.506    0.615    
## conditionmeaningfully    -4.643      7.055 52.000  -0.658    0.513    
## conditionmeaninglessly    3.214      7.055 52.000   0.456    0.651    
## conditionrepeat          -2.418      7.055 52.000  -0.343    0.733    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.588                             
## cndtnmnngfl -0.588  0.500                      
## cndtnmnngls -0.588  0.500  0.500               
## conditinrpt -0.588  0.500  0.500      0.500
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 706.61  176.65     4    52   0.507 0.7308
pwc <- filter5.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    14    14   -0.608     13 0.553     1 ns          
##  2 meanscore answer  meani…    14    14    0.687     13 0.504     1 ns          
##  3 meanscore answer  meani…    14    14   -0.410     13 0.688     1 ns          
##  4 meanscore answer  repeat    14    14    0.435     13 0.67      1 ns          
##  5 meanscore control meani…    14    14    1.49      13 0.16      1 ns          
##  6 meanscore control meani…    14    14    0.0577    13 0.955     1 ns          
##  7 meanscore control repeat    14    14    0.821     13 0.426     1 ns          
##  8 meanscore meanin… meani…    14    14   -1.37      13 0.194     1 ns          
##  9 meanscore meanin… repeat    14    14   -0.269     13 0.792     1 ns          
## 10 meanscore meanin… repeat    14    14    0.557     13 0.587     1 ns
#### (6) performance
filter6.MWdata<- filter(filter.age.M, dimension =="performance")
Model <- lmer(data = filter6.MWdata, meanscore~condition+(1|sub))
summary(Model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: meanscore ~ condition + (1 | sub)
##    Data: filter6.MWdata
## 
## REML criterion at convergence: 601.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0122 -0.4883 -0.1755  0.5333  3.1298 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  sub      (Intercept) 246.0    15.68   
##  Residual             373.4    19.32   
## Number of obs: 70, groups:  sub, 14
## 
## Fixed effects:
##                        Estimate Std. Error     df t value Pr(>|t|)    
## (Intercept)              36.786      6.652 39.858   5.530 2.18e-06 ***
## conditioncontrol          7.143      7.304 52.000   0.978    0.333    
## conditionmeaningfully     1.071      7.304 52.000   0.147    0.884    
## conditionmeaninglessly    6.429      7.304 52.000   0.880    0.383    
## conditionrepeat           2.060      7.304 52.000   0.282    0.779    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) cndtnc cndtnmnngf cndtnmnngl
## condtncntrl -0.549                             
## cndtnmnngfl -0.549  0.500                      
## cndtnmnngls -0.549  0.500  0.500               
## conditinrpt -0.549  0.500  0.500      0.500
anova(Model)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## condition 587.16  146.79     4    52  0.3931 0.8127
pwc <- filter6.MWdata %>% pairwise_t_test(meanscore ~ condition, p.adjust.method = "bonferroni", paired = TRUE) 
pwc
## # A tibble: 10 × 10
##    .y.       group1  group2    n1    n2 statistic    df     p p.adj p.adj.signif
##  * <chr>     <chr>   <chr>  <int> <int>     <dbl> <dbl> <dbl> <dbl> <chr>       
##  1 meanscore answer  contr…    14    14    -1.37     13 0.193     1 ns          
##  2 meanscore answer  meani…    14    14    -0.275    13 0.787     1 ns          
##  3 meanscore answer  meani…    14    14    -0.791    13 0.443     1 ns          
##  4 meanscore answer  repeat    14    14    -0.301    13 0.769     1 ns          
##  5 meanscore control meani…    14    14     0.968    13 0.351     1 ns          
##  6 meanscore control meani…    14    14     0.117    13 0.909     1 ns          
##  7 meanscore control repeat    14    14     0.658    13 0.522     1 ns          
##  8 meanscore meanin… meani…    14    14    -0.654    13 0.525     1 ns          
##  9 meanscore meanin… repeat    14    14    -0.138    13 0.892     1 ns          
## 10 meanscore meanin… repeat    14    14     0.394    13 0.7       1 ns

3.6.2 Acceptance

# read data
USdata <- read_excel("/Users/betty/Desktop/Acceptance (processed).xlsx", sheet=1)

# as factors & groupby
USdata$condition <- as.factor(USdata$condition)
USdata$agegroup2 <- as.factor(USdata$agegroup2)
USdata %>%
  group_by(agegroup2,condition)
## # A tibble: 116 × 7
## # Groups:   agegroup2, condition [8]
##    sub     age agegroup2 order condition     usefulness satisfaction
##    <chr> <dbl> <fct>     <dbl> <fct>              <dbl>        <dbl>
##  1 sub1     42 M             2 meaninglessly       -1.6        -0.25
##  2 sub1     42 M             4 meaningfully         0.8         0.25
##  3 sub1     42 M             5 repeat               0.6         0.25
##  4 sub1     42 M             3 answer               1.4         0.25
##  5 sub10    36 M             4 meaninglessly       -0.2        -0.5 
##  6 sub10    36 M             3 meaningfully        -1.8        -1.75
##  7 sub10    36 M             1 repeat              -1.6        -1.75
##  8 sub10    36 M             2 answer              -0.4        -0.5 
##  9 sub11    28 Y             4 meaninglessly       -1.6        -0.5 
## 10 sub11    28 Y             3 meaningfully        -0.8         0   
## # ℹ 106 more rows
# Analysis of younger drivers
filter.Y<- filter(USdata,agegroup2 =="Y") 

## main effect of countermeasure type on usefulness
Us.fried.useful.young <- filter.Y %>% friedman_test(usefulness ~ condition |sub)
Us.fried.useful.young
## # A tibble: 1 × 6
##   .y.            n statistic    df         p method       
## * <chr>      <int>     <dbl> <dbl>     <dbl> <chr>        
## 1 usefulness    15      24.1     3 0.0000233 Friedman test
## the post hoc analysis for the main effect of countermeasure type on usefulness
pwc.useful.young <- filter.Y %>%  wilcox_test(usefulness ~ condition, paired = TRUE, p.adjust.method = "bonferroni")
pwc.useful.young
## # A tibble: 6 × 9
##   .y.        group1       group2    n1    n2 statistic      p p.adj p.adj.signif
## * <chr>      <chr>        <chr>  <int> <int>     <dbl>  <dbl> <dbl> <chr>       
## 1 usefulness answer       meani…    15    15     115   2  e-3 0.012 *           
## 2 usefulness answer       meani…    15    15     119   8.9e-4 0.005 **          
## 3 usefulness answer       repeat    15    15      53.5 7.4e-2 0.442 ns          
## 4 usefulness meaningfully meani…    15    15      82.5 6.4e-2 0.382 ns          
## 5 usefulness meaningfully repeat    15    15      15   3.6e-2 0.215 ns          
## 6 usefulness meaningless… repeat    15    15      10   5  e-3 0.029 *
## main effect of countermeasure type on satisfaction
Us.fried.satisfaction.young <- filter.Y %>% friedman_test(satisfaction ~ condition |sub)
Us.fried.satisfaction.young
## # A tibble: 1 × 6
##   .y.              n statistic    df        p method       
## * <chr>        <int>     <dbl> <dbl>    <dbl> <chr>        
## 1 satisfaction    15      19.5     3 0.000219 Friedman test
## the post hoc analysis for the main effect of countermeasure type on satisfaction
pwc.satisfaction.young <- filter.Y %>%  wilcox_test(satisfaction ~ condition, paired = TRUE, p.adjust.method = "bonferroni")
pwc.satisfaction.young
## # A tibble: 6 × 9
##   .y.          group1      group2    n1    n2 statistic     p p.adj p.adj.signif
## * <chr>        <chr>       <chr>  <int> <int>     <dbl> <dbl> <dbl> <chr>       
## 1 satisfaction answer      meani…    15    15      94   0.01  0.059 ns          
## 2 satisfaction answer      meani…    15    15     118   0.001 0.006 **          
## 3 satisfaction answer      repeat    15    15      44   0.101 0.606 ns          
## 4 satisfaction meaningful… meani…    15    15      89.5 0.022 0.13  ns          
## 5 satisfaction meaningful… repeat    15    15      25.5 0.17  1     ns          
## 6 satisfaction meaningles… repeat    15    15      10.5 0.005 0.032 *
# Analysis of middle-aged drivers
filter.M <- filter(USdata,agegroup2 =="M") 
## main effect of countermeasure type on usefulness
Us.fried.useful.middle <- filter.M %>% friedman_test(usefulness ~ condition |sub)
Us.fried.useful.middle
## # A tibble: 1 × 6
##   .y.            n statistic    df       p method       
## * <chr>      <int>     <dbl> <dbl>   <dbl> <chr>        
## 1 usefulness    14      14.6     3 0.00218 Friedman test
## the post hoc analysis for the main effect of countermeasure type on usefulness
pwc.useful.middle <- filter.M %>%  wilcox_test(usefulness ~ condition, paired = TRUE, p.adjust.method = "bonferroni")
pwc.useful.middle
## # A tibble: 6 × 9
##   .y.        group1        group2    n1    n2 statistic     p p.adj p.adj.signif
## * <chr>      <chr>         <chr>  <int> <int>     <dbl> <dbl> <dbl> <chr>       
## 1 usefulness answer        meani…    14    14      67   0.031 0.184 ns          
## 2 usefulness answer        meani…    14    14      94   0.01  0.06  ns          
## 3 usefulness answer        repeat    14    14      56.5 0.181 1     ns          
## 4 usefulness meaningfully  meani…    14    14      82   0.068 0.411 ns          
## 5 usefulness meaningfully  repeat    14    14      12.5 0.041 0.247 ns          
## 6 usefulness meaninglessly repeat    14    14      11   0.017 0.104 ns
## main effect of countermeasure type on satisfaction
Us.fried.satisfaction.middle <- filter.M %>% friedman_test(satisfaction ~ condition |sub)
Us.fried.satisfaction.middle
## # A tibble: 1 × 6
##   .y.              n statistic    df     p method       
## * <chr>        <int>     <dbl> <dbl> <dbl> <chr>        
## 1 satisfaction    14      4.36     3 0.225 Friedman test
## the post hoc analysis for the main effect of countermeasure type on usefulness
pwc.satisfaction.middle <- filter.M %>%  wilcox_test(satisfaction ~ condition, paired = TRUE, p.adjust.method = "bonferroni")
pwc.satisfaction.middle
## # A tibble: 6 × 9
##   .y.          group1      group2    n1    n2 statistic     p p.adj p.adj.signif
## * <chr>        <chr>       <chr>  <int> <int>     <dbl> <dbl> <dbl> <chr>       
## 1 satisfaction answer      meani…    14    14      60   0.105 0.63  ns          
## 2 satisfaction answer      meani…    14    14      65   0.045 0.272 ns          
## 3 satisfaction answer      repeat    14    14      30   0.401 1     ns          
## 4 satisfaction meaningful… meani…    14    14      59.5 0.344 1     ns          
## 5 satisfaction meaningful… repeat    14    14      14.5 0.103 0.618 ns          
## 6 satisfaction meaningles… repeat    14    14      28.5 0.139 0.834 ns